Skills / Engineering / Redux Toolkit

Redux Toolkit

Build predictable global state with Redux Toolkit. Generates slices with Immer reducers, configures the store, handles async with createAsyncThunk, and wires data fetching and caching with RTK Query.

This skill helps you write modern Redux with Redux Toolkit (RTK). It scaffolds createSlice reducers with Immer immutability, configures the store and typed hooks, manages async flows with createAsyncThunk, normalizes collections with createEntityAdapter, and replaces hand-rolled fetching with RTK Query endpoints that cache, invalidate, and refetch automatically.

redux redux-toolkit state-management rtk-query react

When to use

Use when building or migrating a Redux app — typed slices and store setup, async thunks, entity normalization, or RTK Query for server-state caching in medium-to-large React applications.

Examples

Typed slice + store

Scaffold a counter slice with hooks

Set up a Redux Toolkit store with a typed cart slice using createSlice, plus typed useAppDispatch and useAppSelector hooks

RTK Query API

Cache server data with endpoints

Create an RTK Query API slice for a REST backend with getPosts and addPost endpoints, cache tags, and automatic invalidation on mutation
Added to wishlist