Skip to content

wallaceyuan/react-redux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

const reducer = (state = {count: 0}, action) => { switch (action.type){ case 'INCREASE': return {count: state.count + 1}; case 'DECREASE': return {count: state.count - 1}; default: return state; } }

const actions = { increase: () => ({type: 'INCREASE'}), decrease: () => ({type: 'DECREASE'}) }

const store = createStore(reducer);

store.subscribe(() => console.log(store.getState()) );

store.dispatch(actions.increase()) // {count: 1} store.dispatch(actions.increase()) // {count: 2} store.dispatch(actions.increase()) // {count: 3}

About

react-redux sample

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published