react-redux:react-redux示例

时间:2024-06-05 08:13:03
【文件属性】:

文件名称:react-redux:react-redux示例

文件大小:391KB

文件格式:ZIP

更新时间:2024-06-05 08:13:03

JavaScript

const reducer =(state = {count:0},action)=> {switch(action.type){case'INCREASE':return {count:state.count + 1}; 情况“减少”:返回{count:state.count-1}; 默认值:返回状态; }} const actions = {增加:()=>({type:'INCREASE'}),减少:()=>({type:'DECREASE'})} const store = createStore(reducer); store.subscribe(()=> console.log(store.getState())); store.dispatch(actions.increase())// {count:1} store.dispatch(actions.increase


【文件预览】:
react-redux-master
----package.json(635B)
----readme.md(558B)
----dist()
--------bundle.js.map(910KB)
--------index.html(314B)
--------bundle.js(827KB)
----src()
--------index.js(422B)
--------two.js(657B)
--------components()
--------store()
----.gitignore(549B)
----webpack.config.js(639B)

网友评论