When to use this skill
Use this skill whenever the user wants to:
- Manage state and side effects with React Hooks (useState, useEffect, useContext, custom hooks)
- Follow the Rules of Hooks and best practices, avoid closure and dependency issues
How to use this skill
- Basics: useState, useEffect (dependency array, cleanup function); useContext, useRef.
- Advanced: useMemo, useCallback, custom Hooks; useReducer, useLayoutEffect.
- Reference:https://react.dev/reference/react
Best Practices
- Dependency arrays are complete; clean up subscriptions and timers.
- Custom Hooks are named useXxx; avoid calling Hooks conditionally or in loops.
Keywords
React Hooks, useState, useEffect, custom Hook