Answer the question
In order to leave comments, you need to log in
How to return to the initial state of the reducer in the redux of a particular property?
There is an initial state
const initialState = {
filter_models: {
adventure_state: null,
type_id: null,
}
}
Answer the question
In order to leave comments, you need to log in
export default function Reducer(state = initialState, action) {
switch (action.type) {
case RESET_TYPE_ID:
return {
...state,
filter_models: {
...state.filter_models,
type_id: null
}
};
const filters = _.pickBy(filterSet, _.identity);
after certain actions, the type_id property has changed, how to roll back to the initial state of only the type_id property without affecting others?
...
, create objects of different nesting in the sandbox, and based on the answer from Yuxus, try to change different fields without breaking the rest.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question