eslint-plugin-react-hooks version: 0.0.0-experimental-c260b38d-20250731
Steps To Reproduce
export const MyComponent = () => {
const onView = 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