选择器在呈现组件之前执行

时间:2018-12-11 18:39:52

标签: javascript reactjs redux reselect

我的选择器在呈现它们所映射的组件之前执行。为什么会这样呢?例如,在下面的代码中,.flex-row-container { background: #aaa; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; } .flex-row-container > .flex-row-item { flex-grow: 1; flex: 1 1 30%; height: 100px; max-width: 200px; float: left; } .flex-row-item { background-color: #fff4e6; border: 1px solid #f76707; } 选择器在messages渲染之前执行。谢谢!

Component

1 个答案:

答案 0 :(得分:2)

在React-Redux v5中,实现mapState的内部选择器是initialized in the wrapper component constructoris called right away as part of that process

在React-Redux v6中,该内部选择器为created in the wrapper component constructor,但为called during the render process