Use Effect Event
use-effect-event
Ponyfill of the `React.useEffectEvent` hook, which became stable in React 19.2
Hooks
effect
hooks
react
react18
react19
sanity
sanity-io
typescript
use
useEffectEvent
Stars
29
Weekly
2.0M
Open issues
5
Bundle
~25 kB
Installation
npm install use-effect-eventCode example
import { useEffectEvent } from "use-effect-event";
export function Example() {
const value = useEffectEvent();
return <p>{String(value)}</p>;
}Pros & cons
Pros
- Actively maintained by Sanity.io <hello@sanity.io>
- 2.0M weekly downloads. Battle tested
- First-class TypeScript definitions
- MIT licensed
Considerations
- Adds roughly ~25 kB to your bundle
- Needs client-only rendering in SSR frameworks
- Not supported in React Native
- 5 open issues on GitHub