Skip to content

useEvent ​

browser
test coverage
Last changed: last month

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

Source ​

Source • Demo

Contributors ​

Avatardebabin
Avatarhywax

Released under the MIT License.