Answer the question
In order to leave comments, you need to log in
Is it possible to change an object property dynamically in Redux?
case SET_VALUE:
return {
data: {
...state.data,
action.payload.type: action.payload.value,
}
};
action.payload.type: action.payload.value,
Answer the question
In order to leave comments, you need to log in
of course, that's how they usually do it.
just do it like this
data: {
...state.data,
[action.payload.type]: action.payload.value,
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question