Skip to content

React Hooks

17 rules eslint-plugin-react-hooks@7.1.1

Complete effective rule inventory.

Docs

Rules

17 rules on this page · 17 total

  • react-hooks/config

    Validates the compiler configuration options

    Autofix available; suggestions available
  • react-hooks/error-boundaries

    Validates usage of error boundaries instead of try/catch for errors in child components

    Autofix available; suggestions available
  • react-hooks/exhaustive-deps

    verifies the list of dependencies for Hooks like useEffect and similar

    Autofix available; suggestions available
  • react-hooks/gating

    Validates configuration of gating mode

    Autofix available; suggestions available
  • react-hooks/globals

    Validates against assignment/mutation of globals during render, part of ensuring that side effects must render outside of render

    Autofix available; suggestions available
  • react-hooks/immutability

    Validates against mutating props, state, and other values that are immutable

    Autofix available; suggestions available
  • react-hooks/incompatible-library

    Validates against usage of libraries which are incompatible with memoization (manual or automatic)

    Autofix available; suggestions available
  • react-hooks/preserve-manual-memoization

    Validates that existing manual memoized is preserved by the compiler. React Compiler will only compile components and hooks if its inference matches or exceeds the existing manual memoization

    Autofix available; suggestions available
  • react-hooks/purity

    Validates that components/hooks are pure by checking that they do not call known-impure functions

    Autofix available; suggestions available
  • react-hooks/refs

    Validates correct usage of refs, not reading/writing during render. See the "pitfalls" section in useRef() usage

    Autofix available; suggestions available
  • react-hooks/rules-of-hooks

    enforces the Rules of Hooks

    No autofix
  • react-hooks/set-state-in-effect

    Validates against calling setState synchronously in an effect. This can indicate non-local derived data, a derived event pattern, or improper external data synchronization.

    Autofix available; suggestions available
  • react-hooks/set-state-in-render

    Validates against setting state during render, which can trigger additional renders and potential infinite render loops

    Autofix available; suggestions available
  • react-hooks/static-components

    Validates that components are static, not recreated every render. Components that are recreated dynamically can reset state and trigger excessive re-rendering

    Autofix available; suggestions available
  • react-hooks/unsupported-syntax

    Validates against syntax that we do not plan to support in React Compiler

    Autofix available; suggestions available
  • react-hooks/use-memo

    Validates usage of the useMemo() hook against common mistakes. See useMemo() docs for more information.

    Autofix available; suggestions available
  • react-hooks/void-use-memo

    Validates that useMemos always return a value and that the result of the useMemo is used by the component/hook. See useMemo() docs for more information.

    Autofix available; suggestions available