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:
William Chargin 2018-07-20 18:50:47 -07:00
parent 04acce4a4c
commit 6be05e91c8
2 changed files with 22 additions and 1 deletions

View File

@ -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>
);
}
}

13
src/app/Page.js Normal file
View File

@ -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>
);
}
}