M
M
Maxim Korolsky2016-12-06 01:10:20
React
Maxim Korolsky, 2016-12-06 01:10:20

How to clear the state of another reducer?

I want to make a universal RESET that would reset the state whenever I want.
I'm trying to transfer the state to be cleared there
. But it can't be cleaned
. What am I doing wrong?

export function resetState(stateNull = initialState, action) {

    let {type, state, id} = action;

    switch (type) {
        case RESET.ACTION_TYPES.RESET:
            return state.delete(id);
        default:
            return stateNull;
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question