If you’ve ever tried to manage global state in a large React app, you’ve probably felt the pain of boilerplate, complexity, and confusion that traditional Redux brought.
But those days are gone. Say hello to Redux Toolkit (RTK) — the official, modern, and clean approach to writing Redux logic.
Redux Toolkit (RTK) is the official, recommended way to write Redux code. It’s a package that simplifies Redux setup and helps you write cleaner, more efficient, and less error-prone state management.
Instead of manually creating actions, reducers, and types — RTK gives you elegant utilities that do the heavy lifting for you.
It’s like upgrading from a manual car to an automatic — same power, less stress.
Here’s why most modern React developers have switched to RTK:
✅ Less Boilerplate: No more writing endless action types or switch statements.
✅ Built-in Immer:
You can write mutable-looking code (state.value += 1), and RTK handles immutability under the hood.
✅ Powerful Async Support:
Handle API calls easily with createAsyncThunk.
✅ Clean Architecture: Slices organize logic by feature, not by file type.
✅ Easy Integration: Works perfectly with TypeScript, React hooks, and Redux DevTools.
+-------------+ +-------------+ +-------------+| UI Event | -----> | Action | -----> | Reducer || (dispatch) | | (Intent) | | (Logic) |+-------------+ +-------------+ +-------------+^ || v+------------------- Store ------------------+(Global State)
Let’s break down the main pieces of Redux Toolkit.
configureStoreCreates the Redux store with sensible defaults — including DevTools and middleware preconfigured.
import { configureStore } from '@reduxjs/toolkit';import counterReducer from './features/counter/counterSlice';export const store = configureStore({reducer: {counter: counterReducer,},});
Simple. No more manual createStore, combineReducers, or thunk setup.
createSliceDefines state, reducers, and actions in one clean place.
import { createSlice } from '@reduxjs/toolkit';const counterSlice = createSlice({name: 'counter',initialState: { value: 0 },reducers: {increment: (state) => { state.value += 1 },decrement: (state) => { state.value -= 1 },reset: (state) => { state.value = 0 }}});export const { increment, decrement, reset } = counterSlice.actions;export default counterSlice.reducer;
Boom 💥 — one slice file replaces what used to be three different files in classic Redux.
createAsyncThunkSimplifies handling async actions like API calls.
import { createAsyncThunk } from '@reduxjs/toolkit';export const fetchPokemons = createAsyncThunk('pokemon/fetchPokemons',async () => {const res = await fetch('https://pokeapi.co/api/v2/pokemon?limit=10');return await res.json();});
RTK automatically generates pending, fulfilled, and rejected action types — all ready to handle in your slice.
Combine it with extraReducers:
import { createSlice } from '@reduxjs/toolkit';import { fetchPokemons } from './pokemonThunks';const pokemonSlice = createSlice({name: 'pokemon',initialState: { list: [], status: 'idle', error: null },reducers: {},extraReducers: (builder) => {builder.addCase(fetchPokemons.pending, (state) => {state.status = 'loading';}).addCase(fetchPokemons.fulfilled, (state, action) => {state.status = 'succeeded';state.list = action.payload.results;}).addCase(fetchPokemons.rejected, (state, action) => {state.status = 'failed';state.error = action.error.message;});},});export default pokemonSlice.reducer;
Now your UI can easily reflect loading, success, or error states.
Once your store and slices are ready:
import React from 'react';import { useSelector, useDispatch } from 'react-redux';import { increment } from './counterSlice';function Counter() {const count = useSelector((state) => state.counter.value);const dispatch = useDispatch();return (<div><h1>Count: {count}</h1><button onClick={() => dispatch(increment())}>Increment</button></div>);}
And wrap your app with <Provider store={store}> in index.js.
Redux Toolkit is Redux done right. It keeps all the benefits — predictable state, time-travel debugging, DevTools — but removes all the noise.
If you’re starting a new React project today, RTK should be your default choice for state management.
Whether you’re building a simple counter or a full-featured Pokémon app 🐉, Redux Toolkit helps you stay clean, scalable, and modern.