overflow_app/src/ts/index.tsx

57 lines
1.4 KiB
TypeScript
Raw Normal View History

2017-06-27 13:00:55 +00:00
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import createSagaMiddleware, { SagaMiddleware } from 'redux-saga';
import { createHashHistory } from 'history';
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'react-router-redux';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import * as injectTapEventPlugin from 'react-tap-event-plugin';
import * as system from 'commons/util/system';
import configureStore from 'config/configureStore';
import muiTheme from 'config/configureMuiTheme';
import App from 'app/views/container/component/App';
injectTapEventPlugin();
const sagaMiddleware: SagaMiddleware<any> = createSagaMiddleware();
const history = createHashHistory();
const store = configureStore(history, sagaMiddleware);
function* app(): any {
const appContainer = yield system.getAppContainer('react-placeholder');
ReactDOM.render(
<div style={{
width: '100vw',
height: '100vh',
backgroundColor: 'white',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}>
<h1>Loading...</h1>
</div>,
appContainer,
);
ReactDOM.render(
<Provider store={store}>
<ConnectedRouter history={history}>
<MuiThemeProvider muiTheme={muiTheme}>
<App/>
</MuiThemeProvider>
</ConnectedRouter>
</Provider>,
appContainer,
);
2017-06-21 11:24:44 +00:00
}
2017-06-27 13:00:55 +00:00
sagaMiddleware.run(app);