-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
48 lines (42 loc) · 1.08 KB
/
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
45
46
47
48
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import {compose, applyMiddleware, combineReducers, createStore} from 'redux';
import {Provider} from 'react-redux';
import thunk from 'redux-thunk';
import userReducer from './reducers/userReducer';
import productsReducer from './reducers/productsReducer';
const rootReducer = combineReducers({
user: userReducer,
products: productsReducer,
});
const allEnhancers = compose(
applyMiddleware(thunk),
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
);
const store = createStore(/*set initial state to reducers*/
rootReducer,
{
products: [{
name: 'Samsung',
type: 'TV'
}],
user: 'USER'
},
allEnhancers
);
/*
const updateUserAction = {
type: 'userUpdate',
payload: {
user: 'New USER'
}
};
store.dispatch(updateUserAction);*/
ReactDOM.render(
<Provider store={store}>
<App count={4}/>
</Provider>, document.getElementById('root'));
serviceWorker.unregister();