Skip to content Skip to sidebar Skip to footer

Update The State Of One Reducer Based On State Of Another Reducer

I've got an state in a reducer with a state that looks like this: This state handles the current user selections. const selection = { timespan: '-3660', customTimespan: false,

Solution 1:

You can do like this:

functiona(state, action) { }
functionb(state, action, a) { } // depends on a's statefunctionsomething(state = {}, action) {
  let a = a(state.a, action);
  let b = b(state.b, action, a); // note: b depends on a for computationreturn { a, b };
}

Cheers:)

Post a Comment for "Update The State Of One Reducer Based On State Of Another Reducer"