useEventCallback
Custom hook that creates a memoized event callback.
Installation
npx sse-tool add use-event-callback
npm install sse-hooks
Usage
import { useEventCallback } from "./{hooks file}";
const handleClick = useEventCallback((event) => {
// Handle the event here
});
import { useEventCallback } from "sse-hooks";
const handleClick = useEventCallback((event) => {
// Handle the event here
});
API
Parameters
| Name | Type | Description |
|---|---|---|
| fn | Function | The callback function. |
Return Value
Returns Function.
A memoized event callback function.