Created
June 19, 2017 08:42
-
-
Save alexnewmannn/7ec0fc9641e6f0686d93bd52b71a03ae to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// src/index.js | |
import createHistory from 'history/createBrowserHistory'; | |
const intrinsicState = {}; | |
const history = createHistory(); | |
const store = configureStore(intrinsicState, history); // this includes the same shared history and also creates reducers, which includes the router ones | |
const locale = 'en'; | |
store.dispatch({ type: 'SET_LANGUAGE', | |
payload: { | |
locale: 'en' | |
} | |
}) | |
render( | |
<Provider store={store}> | |
<ConnectedRouter history={history}> | |
<CasinoSiteApp /> | |
</ConnectedRouter> | |
</Provider>, | |
document.getElementById('app') | |
); | |
//containers/App/index.js (CasinoSiteApp) | |
function App(props: PropTypes) { | |
return ( | |
<main> | |
<Nav /> | |
<Switch> | |
<Route exact path="/" component={Home}/> | |
<Route exact path="/login" component={Login}/> | |
</Switch> | |
</main> | |
); | |
} | |
export default withRouter(connect( | |
mapStateToProps | |
)(translate('app', App))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment