React 19+ · Hook
useEffectEvent
useEffectEvent separates non-reactive logic from an Effect. The returned function reads the latest props and state without making the Effect restart for those values.
Last updated
- Since
- React 19.2
Syntax
const onEvent = useEffectEvent(callback)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
useEffectuseLayoutEffectuseInsertionEffectSeparating Events from Effectseslint-plugin-react-hooks