mirror of
https://github.com/bendtherules/preact-publicpath-bug.git
synced 2026-08-18 22:02:42 +00:00
Generate scaffolding with preact-cli default
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { h, Component } from 'preact';
|
||||
import { Router } from 'preact-router';
|
||||
|
||||
import Header from './header';
|
||||
|
||||
// Code-splitting is automated for routes
|
||||
import Home from '../routes/home';
|
||||
import Profile from '../routes/profile';
|
||||
|
||||
export default class App extends Component {
|
||||
|
||||
/** Gets fired when the route changes.
|
||||
* @param {Object} event "change" event from [preact-router](http://git.io/preact-router)
|
||||
* @param {string} event.url The newly routed URL
|
||||
*/
|
||||
handleRoute = e => {
|
||||
this.currentUrl = e.url;
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div id="app">
|
||||
<Header />
|
||||
<Router onChange={this.handleRoute}>
|
||||
<Home path="/" />
|
||||
<Profile path="/profile/" user="me" />
|
||||
<Profile path="/profile/:user" />
|
||||
</Router>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user