我有一个连接到Redux商店的组件,该组件可以监视商店中的所有更改,但会做出反应而不呈现新视图...
这里是我的来源:
减速器动作
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
}
组件
const mapStateToProps = state => {
return {
currentAction: state.Actions.currentAction,
}
}
export default connect(mapStateToProps)(Parameters);
答案 0 :(得分:0)
我想这是因为您正在修改参数而不是创建一个新参数。尝试将:index=1000 // Full Consts // 347580 KB (commit) // 370652 KB (working set)
0 Const Full Rules // 282416 KB (commit) // 305252 KB (working set)
0 Const 0 Rule // 282404 KB (commit) // 305200 KB (working set)
1 Const 1 Rule // 290408 KB (commit) // 313136 KB (working set)
index=8760 // Full Consts // 1675860 KB (commit) // 1695676 KB (working set)
替换为:
currentAction.parameters[i].value = PROP_VALUE;