Manage application state using Redux, MobX, Zustand, and Context API. Use when centralizing state for complex applications with multiple components.
Implement scalable state management solutions using modern patterns and libraries to handle application state, side effects, and data flow across components.
Minimal working example:
// store/userSlice.ts
import { createSlice, createAsyncThunk, PayloadAction } from '@reduxjs/toolkit';
interface User {
id: number;
name: string;
email: string;
}
interface UserState {
items: User[];
loading: boolean;
error: string | null;
}
const initialState: UserState = {
items: [],
loading: false,
error: null
};
export const fetchUsers = createAsyncThunk(
'users/fetchUsers',
async (_, { rejectWithValue }) => {
try {
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents | |---|---| | Redux with Redux Toolkit (React) | Redux with Redux Toolkit (React) | | Zustand (Lightweight State Management) | Zustand (Lightweight State Management) | | Context API + useReducer | Context API + useReducer | | MobX (Observable State) | MobX (Observable State) |
Copy a source-pinned command for your client. You run it yourself.
Destination: .claude/skills/frontend-state-management · pinned to the source commit
git clone https://github.com/aj-geddes/useful-ai-prompts.git
cd useful-ai-prompts
git checkout 3f5182cfd739fc113f4af5244a1cf342ad7f7911
mkdir -p ".claude/skills/frontend-state-management"
cp -r "skills/frontend-state-management" ".claude/skills/frontend-state-management"Review the source before running. This copies files into your project; it is not a one-click install and does not verify runtime safety.
Scanner static-checks@0.1.0 · commit 3f5182cfd739. Static checks cannot prove runtime safety – review the source and the exact diff before installing. How checks work.
No static rules matched. This is not a safety guarantee.