Files: 797539afe1ecc1750ba1b41a253a250e56b5b7ca / app / client.js
727 bytesRaw
1 | const React = require('react') |
2 | const { render } = require('react-dom') |
3 | const { createStore, applyMiddleware } = require('redux') |
4 | const { Provider } = require('react-redux') |
5 | const logger = require('redux-logger') |
6 | const thunk = require('redux-thunk') |
7 | |
8 | const reducer = require('./reducers') |
9 | const { getAllTodos } = require('./actions') |
10 | const App = require('./containers/App') |
11 | |
12 | const middleware = process.env.NODE_ENV === 'production' ? |
13 | [ thunk ] : |
14 | [ thunk, logger() ] |
15 | |
16 | const createStoreWithMiddleware = applyMiddleware(...middleware)(createStore) |
17 | const store = createStoreWithMiddleware(reducer) |
18 | |
19 | store.dispatch(getAllTodos()) |
20 | |
21 | render( |
22 | <Provider store={store}> |
23 | <App /> |
24 | </Provider>, |
25 | document.getElementById('root') |
26 | ) |
27 |
Built with git-ssb-web