Created
March 21, 2018 02:36
-
-
Save tamhv/9e2e5c49f71c701affd4430fb98a8fce to your computer and use it in GitHub Desktop.
reset redux state by action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# delete all state alter log out | |
const appReducer = combineReducers({ | |
todos, | |
visibilityFilter | |
}); | |
const rootReducer = ( state, action ) => { | |
if ( action.type === LOG_OUT ) { | |
state = undefined; | |
} | |
return appReducer(state, action) | |
} | |
const store = createStore(rootReducer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment