Dung (Donny) Nguyen

Senior Software Engineer

Redux Toolkit

🧰 Redux Toolkit is the official, batteries-included toolset for efficient Redux development. It was created to simplify the process of writing Redux logic by reducing boilerplate and offering sensible defaults.

🚀 Why Use Redux Toolkit?

🧪 Key Features

Feature Description
configureStore() Sets up the store with good defaults
createSlice() Combines reducer and action creation into one step
createAsyncThunk() Simplifies writing async logic like API calls
RTK Query Built-in data fetching and caching layer

📦 Installation

npm install @reduxjs/toolkit react-redux

🧩 Example Usage

import { configureStore, createSlice } from '@reduxjs/toolkit';

const counterSlice = createSlice({
  name: 'counter',
  initialState: 0,
  reducers: {
    increment: state => state + 1,
    decrement: state => state - 1,
  },
});

export const { increment, decrement } = counterSlice.actions;

const store = configureStore({
  reducer: {
    counter: counterSlice.reducer,
  },
});

Redux Toolkit is especially handy for TypeScript users, it plays well with enums, dynamic mappings, and scalable architecture.