Last active
June 1, 2017 13:37
-
-
Save markogresak/454dfc88e61ce4dfe6ba01529e0246a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"react": "^15.5.4", | |
"react-dom": "^15.5.4", | |
"react-hot-loader": "3.0.0-beta.7", | |
"react-redux": "^5.0.5", | |
"react-router-dom": "^4.1.1", | |
"react-router-redux": "^5.0.0-alpha.6", | |
"redux": "^3.3.1", | |
"redux-form": "^6.7.0", | |
"webpack": "^2.6.1", | |
"webpack-dev-server": "^2.4.5", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import createHistory from 'history/createBrowserHistory'; | |
import {routerMiddleware} from 'react-router-redux'; | |
import rootReducer from './reducers'; | |
import RootContainer from './components/RootContainer'; | |
// ... rest of imports | |
const history = createHistory(); | |
const historyMiddleware = routerMiddleware(history); | |
// ... store configuration | |
const render = (Component, props) => { | |
ReactDOM.render( | |
<AppContainer> | |
<Component {...props} /> | |
</AppContainer>, | |
document.getElementById('root') | |
); | |
}; | |
render(RootContainer, {history, store}); | |
if (canUseHotReload()) { | |
module.hot.accept(['./components/RootContainer', './reducers'], () => { | |
render(RootContainer, {history, store}); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Provider} from 'react-redux'; | |
// ... rest of imports | |
const RootContainer = ({store, history}) => { | |
return ( | |
<Provider store={store}> | |
<Routes history={history} /> | |
</Provider> | |
); | |
}; | |
// propTypes, export |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Route, Switch} from 'react-router-dom'; | |
import {ConnectedRouter} from 'react-router-redux'; | |
// ... rest of imports | |
const Routes = ({history}) => { | |
return ( | |
<ConnectedRouter history={history}> | |
<div> | |
<Switch> | |
{/* ... */} | |
</Switch> | |
</div> | |
</ConnectedRouter> | |
); | |
}; | |
// propTypes, export |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment