Created
July 14, 2017 02:07
-
-
Save btg5679/12f13ac0063087951231d593b240fb55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore } from 'redux'; | |
const reducer = function(state, action){ | |
if(action.type === 'CMT'){ | |
return state + action.payload; | |
} | |
return state; | |
} | |
const store = createStore(r, { | |
user: { | |
name: 'wacko', | |
age: 48 | |
}, | |
commentCount: 2, | |
loginHistory: { | |
loginDate: '2017-01-01', | |
result: 'success' | |
}, | |
... | |
}); | |
//Action dispatched to your Store | |
store.dispatch({ type: 'CMT', payload: 1 }); | |
//Called any time an action is dispatched | |
store.subscribe(()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment