How to get back to the initial state of reducer in redux?

0 like 0 dislike
5 views
How to get back to the initial state of reducer in redux, ie falling back to initialState?
by | 5 views

1 Answer

0 like 0 dislike
const RESET = 'MODULE_NAME::RESET'; const reset => () => ({ type: RESET }); const initialState = { // someState }; const reducer = (state = initialState, action) => { const { type, payload } = action; switch (type) { case RESET: return initialState; // ... } };
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
33,905 users