Bug: rules-of-hooks ESLint rule not catching conditional hooks in React.memo() (Typescript) #19117
Labels
Component: ESLint Rules
Resolution: Expected Behavior
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
I've noticed that the "no conditional hooks" aspect of the
rules-of-hooks
eslint rule isn't working inside aReact.memo()
'ed component. The project is typescript and I'm using the parse from@typescript-eslint/parser
, so I'm not sure if the problem is with the rule or with the parser.React version:
Steps To Reproduce
React.memo()
inside a Typescript projectLink to code example: https://codesandbox.io/s/no-rules-of-hooks-warning-in-typescript-reactmemo-ei00n?file=/src/index.tsx
The current behavior
ESLint does not show any errors.
The expected behavior
ESLint should show an error like
React Hook "React.useEffect" is called conditionally. React Hooks must be called in the exact same order in every component render.
The text was updated successfully, but these errors were encountered: