如图所示,这是一个非常简单的例子:只有两个文件package.json和index.ios.js, 点击加1按钮数字值就会+1, 点击减1按钮数字值就会-1, 点击归零按钮则数字值置为0。...action名称, 定义三个常量action, 分别表示增加、减小、重置。...reset = () => ({ type: RESET });
export {
increase,
decrease,
reset
}
3,创建reducers.js, 根据需要在收到相关的.../app';
AppRegistry.registerComponent('Helloworld', () => App);
这样,我们就将redux引入到了React Native中。...commond+R运行, command+D打开chrome浏览器调试, 可以看到redux-logger把每个action动作都打和state的前后变化印出来。
?
参考:深入理解redux