eslint-plugin-react-hooks
The official ESLint plugin that checks React code for Rules of Hooks violations and incomplete dependency arrays.
In more detail
Its rules-of-hooks rule flags hooks called conditionally, and exhaustive-deps flags values missing from dependency arrays. Recent versions also include React Compiler checks, so code the compiler cannot optimise is reported.
Related terms
- ESLint — A tool that reads JavaScript and TypeScript code and reports likely bugs and style problems before the code runs.
- Rules of Hooks — The two rules for hooks: call them only at the top level, never in conditions, loops or nested functions, and only from React components or custom hooks.
- dependency array — The array of values given to hooks such as useEffect, useMemo and useCallback that tells React when to re-run them.
Taught in
- Rules of Hooks: Call Order, Hook Lists, And Fiber Storage — React 19 & Modern Component Architecture