forked from saurshaz/super-simple-redux
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
29 lines (22 loc) · 823 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
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import {storeGlobal} from './store'
// Create a Redux store holding the state of your app.
// Its API is { subscribe, dispatch, getState }.
let store = storeGlobal()
// You can use subscribe() to update the UI in response to state changes.
// Normally you'd use a view binding library (e.g. React Redux) rather than subscribe() directly.
// However it can also be handy to persist the current state in the localStorage.
store.subscribe(() =>
console.log(store.getState())
)
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>
,document.getElementById('root'));
registerServiceWorker();