Add basic react-router@3 routing
Summary: This commit introduces a `Page` component that we can use to provide common styling and navigation to our pages. wchargin-branch: use-rrv3
This commit is contained in:
parent
04acce4a4c
commit
6be05e91c8
|
@ -1,11 +1,19 @@
|
|||
// @flow
|
||||
|
||||
import React from "react";
|
||||
import {IndexRoute, Route, Router, browserHistory} from "react-router";
|
||||
|
||||
import Page from "./Page";
|
||||
import CredExplorer from "./credExplorer/App";
|
||||
|
||||
export default class App extends React.Component<{}> {
|
||||
render() {
|
||||
return <CredExplorer />;
|
||||
return (
|
||||
<Router history={browserHistory}>
|
||||
<Route path="/" component={Page}>
|
||||
<IndexRoute component={CredExplorer} />
|
||||
</Route>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// @flow
|
||||
|
||||
import React, {type Node} from "react";
|
||||
|
||||
export default class Page extends React.Component<{|+children: Node|}> {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<main>{this.props.children}</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue