dispatch/client/src/js/index.js

32 lines
812 B
JavaScript
Raw Normal View History

2015-12-28 23:34:32 +00:00
import React from 'react';
import { render } from 'react-dom';
import { AppContainer } from 'react-hot-loader';
2017-02-16 02:55:50 +00:00
import 'react-virtualized/styles.css';
2015-12-28 23:34:32 +00:00
import configureStore from './store';
2017-05-19 05:29:44 +00:00
import initRouter from './util/router';
import routes from './routes';
2015-12-28 23:34:32 +00:00
import Socket from './util/Socket';
import Root from './containers/Root';
2017-05-19 05:29:44 +00:00
import runModules from './modules';
2015-12-28 23:34:32 +00:00
2017-02-16 02:55:50 +00:00
const host = DEV ? `${window.location.hostname}:1337` : window.location.host;
const socket = new Socket(host);
const store = configureStore(socket);
2017-05-19 05:29:44 +00:00
initRouter(routes, store);
runModules({ store, socket });
2017-05-21 20:59:35 +00:00
const renderRoot = () => render(
<AppContainer>
<Root store={store} />
</AppContainer>,
document.getElementById('root')
);
renderRoot();
if (module.hot) {
module.hot.accept('./containers/Root', () => renderRoot());
}