-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
44 lines (36 loc) · 868 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import 'babel-polyfill'
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import App from './containers/App'
import 'todomvc-app-css/index.css'
import boot from 'redux-boot'
import todo from './modules/todo'
import devel from './modules/sandbox/devel'
const initialState = Object.assign({}, {
todos: [
{
text: 'Use Redux Boot',
completed: false,
id: 0
}
]
}, JSON.parse(localStorage.getItem('state')))
const modules = [
devel,
todo
]
const app = boot(initialState, modules)
app.then(({action, store}) => {
// Save state in local storage.
store.subscribe(() => {
const state = store.getState()
localStorage.setItem('state', JSON.stringify(state))
})
render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
)
})