1
rated 0 times
[
6]
[
5]
/ answers: 1 / hits: 23293
/ 7 Years ago, thu, january 26, 2017, 12:00:00
I have a state in a reducer that looks like this:
// The current source/selection
const selection = {
timespan: -3660,
customTimespan: false,
pathIds: [''],
source: undefined,
direction: 0,
appClassIds: []
};
What I want now is to update multiple properties (timespan and customTimeSpan), something like this (but this doesn't work):
{ ...state,
{
timespan: action.timespan.value,
customTimespan: action.timespan.value
}
};
How can I update multiple properties of a state?
More From » reactjs