我的选择器在呈现它们所映射的组件之前执行。为什么会这样呢?例如,在下面的代码中,.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
答案 0 :(得分:2)
在React-Redux v5中,实现mapState
的内部选择器是initialized in the wrapper component constructor和is called right away as part of that process。
在React-Redux v6中,该内部选择器为created in the wrapper component constructor,但为called during the render process。