Let's say I have two reducers imported from two slices authSlice
and uiSlice
import { configureStore, ThunkAction, Action } from "@reduxjs/toolkit"
import authReducer from "./auth/authSlice"
import uiReducer from "./ui/uiSlice"
export const store = configureStore({
reducer: {
auth: authReducer,
ui: uiReducer,
},
})
I am able to reset state of authSlice
using this code in reducers
...
const initialState: InitialState = {
permissions: [],
loggedIn: false,
}
...
logout: () => {
return initialState
},
...
But I haven't been able to find a way to reset to all initialState
s in all slices.
I want to be able to reset uiSlice
and authSlice
to their particular initialState
s.