Skip to content

useEvent ​

Category
Browser

Hook that creates an event and returns a stable reference of it

typescript
import { useEvent } from '@siberiacancode/reactuse';

Usage ​

typescript
const onClick = useEvent(() => console.log('clicked'));

Demo ​

Api ​

Parameters

NameTypeDefaultNote
callback(...args: Params) => Return-The callback function

Contributors ​

Source • Demo