I have Component that connects to the Redux store, this component can watch all changes in the store but react not rendering new view...
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;
with :
currentAction.parameters[i] = {
...currentAction.parameters[i]
value: PROP_VALUE
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.