How do I reset the state to its initial state?
I can't seem to reset the default state; how do I do that? I tried this but all it does is add state to state and calls it undefined. const initialState = { name: null, coins: 0, image: null, }; export default function reducer(state = initialState, action = {}) { switch (action.type) { case types.ADD_GROUP_COINS: return { ...state, coins: state.coins + action.coins }; case types.DELETE_GROUP: return { state: undefined }; default: return state; } }
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.