Created
October 21, 2017 04:20
-
-
Save justincorrigible/ad07b6c7412684901abe7d283c57db60 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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import {Provider} from 'react-redux'; | |
import {AppContainer} from 'react-hot-loader'; | |
import configureStore from './configureStore'; | |
import {Route} from 'react-router'; | |
import {ConnectedRouter} from 'react-router-redux'; | |
import {debounce} from 'lodash'; | |
import {uiActions} from 'actions/'; | |
import Stage from 'containers/stage'; | |
import './styles/scaffolds.scss'; | |
import './favicon.ico'; | |
import 'font-awesome-webpack'; | |
const store = configureStore(); | |
window.addEventListener('resize', debounce(() => | |
store.dispatch( | |
uiActions.screenResize( | |
window.innerWidth, window.innerHeight | |
)), 300)); | |
const render = Component => { | |
ReactDOM.render( | |
<AppContainer> | |
<Provider store={store}> | |
<ConnectedRouter history={store.history}> | |
<Route path="/:template?/:region?" component={Component} persistor={store.persistor}/> | |
</ConnectedRouter> | |
</Provider> | |
</AppContainer>, | |
document.getElementById('react_wrapper') | |
); | |
}; | |
render(Stage); | |
if (module.hot) { | |
module.hot.accept('containers/stage', () => { render(Stage); }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment