react-redux基本使用
图解:
代码:
代码:
var createStore = require('redux').createStorevar indexStore = createStore(function(state=0,action){switch(action.type){ case 1: return ++state case 0: return --state default: return state}})indexStore.subscribe(function(){console.log(indexStore.getState())})indexStore.dispatch({type:1})
效果:
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。