Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Combining Reducers Cleanly | Scaling Redux in Larger Applications
Gerenciamento de Estado com Redux Toolkit no React

bookCombining Reducers Cleanly

Deslize para mostrar o menu

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.

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 6. Capítulo 3

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Seção 6. Capítulo 3
some-alt