Redux 常见问题解答
¥Redux FAQ
目录
¥Table of Contents
一般的
¥General
Reducer
组织状态
¥Organizing State
存储设置
¥Store Setup
行动
¥Actions
为什么类型应该是字符串,或者至少是可序列化的?为什么我的操作类型应该是常量?
¥Why should type be a string, or at least serializable? Why should my action types be constants?
¥Is there always a one-to-one mapping between reducers and actions?
如何表示 AJAX 调用等“副作用”?为什么我们需要“动作创建者”、“thunk”和“中间件”之类的东西来执行异步行为?
¥Should I dispatch multiple actions in a row from one action creator?
不可变数据
¥Immutable Data
代码结构
¥Code Structure
表现
¥Performance
设计决策
¥Design Decisions
¥Why doesn't Redux pass the state and action to subscribers?
为什么 Redux 不支持使用 actions 和 reducer 类?
¥Why doesn't Redux support using classes for actions and reducers?
为什么 mapDispatchToProps 不允许使用
getState()
或mapStateToProps()
的返回值?¥Why doesn't mapDispatchToProps allow use of return values from
getState()
ormapStateToProps()
?
反应还原
¥React Redux
为什么我的组件没有重新渲染,或者我的 mapStateToProps 没有运行?
¥Why isn't my component re-rendering, or my mapStateToProps running?
为什么我的连接组件中没有 this.props.dispatch 可用?
¥Why don't I have this.props.dispatch available in my connected component?
¥Should I only connect my top component, or can I connect multiple components in my tree?
各种各样的
¥Miscellaneous