【文件属性】:
文件名称:simple-react-redux:将Redux与React结合使用的简单示例
文件大小:4KB
文件格式:ZIP
更新时间:2021-05-08 14:52:41
react-redux示例
将和连接到简单示例。
与其他传统示例相比,该示例更为简单。 它没有任何动作常量或任何动作方法。
确保使用Babel --stage 0进行编译。
店铺
该商店将把任何动作分派到任意数量的reducer,这将改变您的状态。
import { createStore } from 'redux'
const initial = {
counter : 0
}
const Store = createStore ( ( state = initial , action ) => {
switch ( action . type ) {
case 'counter:increment' :
return { ... state , counter : state . counter + 1 }
case 'counter:set' :
【文件预览】:
simple-react-redux-master
----Async.md(1KB)
----Routing.md(58B)
----Reducer_objects.md(466B)
----README.md(2KB)
----Combining_reducers.md(1007B)
----Actions.md(507B)