You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{createSlice}from'@reduxjs/toolkit'exportconstauthSlice=createSlice({// name of slice (must be unique)name: 'auth',initialState: {status: false,},reducers: {// action: action handlerlogin: (state)=>{state.status=true},// action: action handlerlogout: (state)=>{state.status=false},},})exportconst{ login, logout }=authSlice.actionsexportdefaultauthSlice.reducer
add the slice's reducer to the store configuration
import{configureStore}from'@reduxjs/toolkit'importauthSlicefrom'./features/authSlice'// create a new storeexportconststore=configureStore({reducer: {auth: authSlice,},})