Skip to content

useEvent ​

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

browser
test coverage
Last changed: last month

Installation ​

Library
CLI
Manual
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

Returns

(...args: Params) => Return

Source ​

Source • Demo

Contributors ​

D
debabin
debabin
H
hywax
hywax

Released under the MIT License.