diff options
| author | Haishan <[email protected]> | 2018-10-23 23:35:11 +0800 |
|---|---|---|
| committer | Haishan <[email protected]> | 2018-10-23 23:35:11 +0800 |
| commit | 3aa50333dc9187e309389d0286c71bea3b31fbbb (patch) | |
| tree | 1e725becac5fb15248f1e8e9fb471f1613632229 /src/components | |
| parent | 09c6bf12e93ba265898c46f00bc73891cb2896dd (diff) | |
react: using async react
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Root.js | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/components/Root.js b/src/components/Root.js index 7c6622a..9399c18 100644 --- a/src/components/Root.js +++ b/src/components/Root.js @@ -1,8 +1,9 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Provider } from 'react-redux'; -import { Router, Route } from 'react-router-dom'; +import { HashRouter as Router, Route } from 'react-router-dom'; import { hot } from 'react-hot-loader'; +// import createHistory from 'history/createHashHistory'; +// import createHistory from 'history/createBrowserHistory'; import SideBar from 'c/SideBar'; import Home from 'c/Home'; @@ -12,6 +13,8 @@ import Config from 'c/Config'; import APIDiscovery from 'c/APIDiscovery'; +import { store } from '../store/configureStore'; + // testing... // import StyleGuide from 'c/StyleGuide'; // import Loading from 'c/Loading'; @@ -30,18 +33,18 @@ import APIDiscovery from 'c/APIDiscovery'; import './Root.scss'; import s0 from './Root.module.scss'; -const Root = ({ store, history }) => ( +const Root = () => ( <Provider store={store}> - <Router history={history}> + <Router> <div className={s0.app}> <APIDiscovery /> <Route path="/" component={SideBar} /> <div style={{ flexGrow: '1', overflow: 'scroll' }}> - <Route exact path="/" component={Home} /> - <Route exact path="/overview" component={Home} /> - <Route exact path="/configs" component={Config} /> - <Route exact path="/logs" component={Logs} /> - <Route exact path="/proxies" component={Proxies} /> + <Route exact path="/" render={() => <Home />} /> + <Route exact path="/overview" render={() => <Home />} /> + <Route exact path="/configs" render={() => <Config />} /> + <Route exact path="/logs" render={() => <Logs />} /> + <Route exact path="/proxies" render={() => <Proxies />} /> </div> </div> </Router> @@ -50,11 +53,6 @@ const Root = ({ store, history }) => ( // <Route exact path="/__0" component={StyleGuide} /> // <Route exact path="/__1" component={Loading} /> -Root.propTypes = { - store: PropTypes.object, - history: PropTypes.object -}; - // hot export Root // https://github.com/gaearon/react-hot-loader/tree/v4.0.1#getting-started export default hot(module)(Root); |
