Bug: eslint-plugin-react-hooks incorrectly flags useSomething() in loop, while allowing use() in React 19 #32789
Labels
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
React version: 19.0.0
eslint-plugin-react-hooks: 5.3.1
Steps To Reproduce
Link to code example:
The current behavior
Calling useSomething() inside a loop triggers a lint error:
React Hook "useSomething" may be executed more than once. Possibly because it is called in a loop.
But calling use() inside the same loop does not trigger an error.
The expected behavior
React 19 allows use(promise) to be called in a loop, but eslint-plugin-react-hooks only allows use(), not custom hooks like useSomething().
Since React 19’s implementation no longer treats use() as special by name, ESLint should ideally match this behavior and allow user-defined useSomething() calls in the same pattern, or clearly define why use() is a special case.
The text was updated successfully, but these errors were encountered: