-
Notifications
You must be signed in to change notification settings - Fork 50.7k
Closed
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug
Description
React version: 18.2.0
Steps To Reproduce
-
Use a hook inside a
do/whileloop. -
You'll see that it's not considered a violation of the rule.
Code example:
function ComponentWithHookInsideDoWhile() {
do {
useHookInsideLoop();
} while (true);
}
The current behavior
The react-hooks/rules-of-hooks does not consider hook usage inside a do/while loop a violation.
The expected behavior
I expected that I'd see the following ESLint error:
React Hook useHookInsideLoop() may be executed more than once.
Possibly because it is called in a loop.
React Hooks must be called in the exact same order in every component render.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug