Combining Reducers Cleanly
Veeg om het menu te tonen
When you have multiple slices, you need to combine them in the store. Redux Toolkit makes this simple.
Combining Slices
You pass all slice reducers into configureStore:
import { configureStore } from '@reduxjs/toolkit';
import userReducer from '../features/user/userSlice';
import tasksReducer from '../features/tasks/tasksSlice';
export const store = configureStore({
reducer: {
user: userReducer,
tasks: tasksReducer
}
});
Each slice becomes a key in the global state.
You can access them like this:
state.user;state.tasks.
This keeps your state structured and predictable. Each part of the app has a clear place in the store.
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 6. Hoofdstuk 3
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Sectie 6. Hoofdstuk 3