Skip to content
← Back to rules

react/memo-dependencies Suspicious

What it does

Validates that useMemo() and useCallback() declare comprehensive dependency lists without extraneous values.

Powered by the React Compiler, which runs once per file and is shared with the other React Compiler rules. Port of react-hooks/memo-dependencies.

Why is this bad?

Missing dependencies produce stale memoized values; extraneous ones cause unnecessary recomputation.

How to use

To enable this rule using the config file or in the CLI, you can use:

json
{
  "plugins": ["react"],
  "rules": {
    "react/memo-dependencies": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["react"],
  rules: {
    "react/memo-dependencies": "error",
  },
});
bash
oxlint --deny react/memo-dependencies --react-plugin

Version

This rule was added in vnext.

References