Skip to content

Instantly share code, notes, and snippets.

@alexnewmannn
Created June 19, 2017 08:42
Show Gist options
  • Save alexnewmannn/7ec0fc9641e6f0686d93bd52b71a03ae to your computer and use it in GitHub Desktop.
Save alexnewmannn/7ec0fc9641e6f0686d93bd52b71a03ae to your computer and use it in GitHub Desktop.
// 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