react中的组件提倡stateless,那么如果需要sate的时候,是否要把state交由redux的store管理,APP中什么样的state交给store?
关于同步本地存储,在哪个环节同步?为什么在componentWillReceiveProps() (组件在接收到新的props之后,render之前的周期)里面同步会比操作慢半拍?
将action actionCreator 和 reducer 放在同一个文件内?
reducer提倡可预测的函数,不使用Date.now() ,如果想记录任务的创建时间,怎么做?
关于type的命名格式:type命名:一级频道大写/action作用,如APP/ADD、APP/DELETE等
关于一个warning:将div设置可编辑状态,同时div显示redux store里的数据,div编辑后redux store也同步更新,不妥之处?
Warning: A component is `contentEditable` and contains `children` managed by React. It is now your responsibility to guarantee that none of those nodes are unexpectedly modified or duplicated. This is probably not intentional.
官方解释 解决方案:在15.0版本下添加suppressContentEditableWarning 属性
数据流:
展示组件dispatch 一个action ==> 触发reducer ,并传参state 和action ==> 依据action 的type 选择相应的reducer 处理数据,并返回一个新的state ==> 根 reducer 应该把多个子 reducer 输出合并成一个单一的 state 树==>
redux 的store 发生变化,触发connect 的mapStateToProps ,将新的数据传给container ,UI渲染 (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|