I am pretty much new to redux and i am using redux-toolkit here.
Is there any way to export multiple slices from a single slice file in redux-toolkit??
example
import { createSlice } from '@reduxjs/toolkit';
const isAuthenticated = createSlice({
name: isAuthenticated,
initialState: false,
reducers: {
loginSuccess(state, action) {
return true;
},
logout(state, action) {
return false;
},
},
});
const currentUser = createSlice({
name: currentUser,
initialState: {},
reducers: {
setUserDetailsApi(state, action) {
return action.user;
},
},
});
export const { loginSuccess, logout } = isAuthenticated.actions;
export const { setUserDetailsApi } = currentUser.actions;
export default isAuthenticated.reducer;
//how should i export currentUser.reducer??
Actually i am trying to replicate my code of vanilla redux here which has multiple reducer in a single file.
Please correct me if i am doing anything wrong here. Thanks