[英]Component connected to the store but react not rerendering view
I have Component that connects to the Redux store, this component can watch all changes in the store but react not rendering new view... 我有连接到Redux商店的Component,这个组件可以监视商店中的所有更改但反应不呈现新视图...
Here My Sources: 在这里我的来源:
Reducer Action 减速机动作
case 'SET_ACTION_PROPERTY_VALUE':
const PROP_NAME = action.payload.name;
const PROP_VALUE = action.payload.value;
let currentAction = state.currentAction;
for(var i=0;i< currentAction.parameters.length;i++) {
if(currentAction.parameters[i].name === PROP_NAME) {
currentAction.parameters[i].value = PROP_VALUE;
break;
}
}
return {
...state,
currentAction
}
component 零件
const mapStateToProps = state => {
return {
currentAction: state.Actions.currentAction,
}
}
export default connect(mapStateToProps)(Parameters);
I guess it is because you are mutating the parameter instead of creating a new one. 我想这是因为您正在改变参数而不是创建一个新参数。 Try replacing :
currentAction.parameters[i].value = PROP_VALUE;
尝试替换:
currentAction.parameters[i].value = PROP_VALUE;
with : 用:
currentAction.parameters[i] = {
...currentAction.parameters[i]
value: PROP_VALUE
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.