When to use this skill
Use this skill whenever the user wants to:
- Manage global state in React applications with Redux (store, reducer, action, dispatch)
- Use Redux Toolkit (createSlice, configureStore) or the classic approach
How to use this skill
- Core:store、reducer、action、dispatch; useSelector、useDispatch。
- Toolkit: createSlice, configureStore, createAsyncThunk; DevTools and middleware.
- Reference:https://react-redux.js.org/ 、https://redux-toolkit.js.org/
Best Practices
- Keep state flat, split reducers by domain; actions and reducers are pure functions.
- Use thunk or RTK Query for async; avoid making requests in reducers.
Keywords
redux, Redux Toolkit, store, state management, React