You could do the following:
const resetState = () => ({
type: 'RESET_STATE'
})
const appReducer = combineReducers({
/* your app’s top-level reducers */
})
const rootReducer = (state, action) => {
if (action.type === 'RESET_STATE') {
state = undefined
}
return appReducer(state, action)
}
function resetAndUpdateOneSlice() {
return (dispatch, getState) {
const slice = Object.assign({}, getState().slice)
//assuming your slice is an object
//just want to demonstrate cloning your data before you reset your state.
dispatch(resetState())
dispatch(updateSliceOfState(slice))
}
}
This is one possible solution - a mixture of pure functions and thunks - though I'm not sure why you want to reset so many parts of your state. Not that I'm condemning your decision, I'm just trying to figure out a use case that's not entirely contrived.
The following is possible since we're using pure functions.
Also, I'm referencing this article, since it was quite helpful.
How to reset the state of a Redux store?
Hope this helps