Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/eslint-plugin-react-hooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,14 @@ This option accepts a regex to match the names of custom Hooks that have depende
rules: {
// ...
"react-hooks/exhaustive-deps": ["warn", {
additionalHooks: "(useMyCustomHook|useMyOtherCustomHook)"
additionalHooks: "^(useMyCustomHook|useMyOtherCustomHook)$"
}]
}
}
```

**Note:** The regex should use anchors (`^` and `$`) to ensure exact matching. Without anchors, the pattern `(useMyCustomHook|useMyOtherCustomHook)` would also match `useMyCustomHook2` or `useMyOtherCustomHookTest`.

We suggest to use this option **very sparingly, if at all**. Generally saying, we recommend most custom Hooks to not use the dependencies argument, and instead provide a higher-level API that is more focused around a specific use case.

## Valid and Invalid Examples
Expand Down