You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug: ESLint react-hooks/rules-of-hooks: false positive XXX is a function created with React Hook "useEffectEvent", and can only be called from the same component #34074
exportconstMyComponent=()=>{constonView=useEffectEvent(()=>{// On view});React.useEffect(()=>{onView();// ❌ Error: `onView` is a function created with React Hook "useEffectEvent", and can only be called from the same component},[]);return<div/>;};
This is a bit weird to get this reported as this seems to be correct: it's used in the same useEffect, not exported.
Also the same code works with the version 0.0.0-experimental-12bc60f5-20250613
The current behavior
This error is thrown
The expected behavior
This code should pass as per the react-hooks rules regarding useEffectEvent