useEventCallback
Custom hook that creates a memoized event callback.
Installation
npx sse-hooks add use-event-callback
yarn dlx sse-hooks add use-event-callback
pnpm dlx sse-hooks add use-event-callback
deno run -A npm:sse-hooks add use-event-callback
bunx sse-hooks add use-event-callback
Usage
example.ts
import { useEventCallback } from "./{hooks file}";
const handleClick = useEventCallback((event) => {
// Handle the event here
});
API
Parameters
| Prop | Default | Type |
|---|---|---|
fn | - |
The callback function. |
Returns
| Return Value | Default | Type |
|---|---|---|
return | - |
Hook return value |
Types Aliases
No specific type aliases defined for this component.
Changelog
useNetworkInformation
Custom hook that tracks the device's network connection status and details (speed, type) using the Network Information API.
useKbd
Custom hook that detects the operating system (Mac vs. Windows/Linux) and provides a normalized map of keyboard keys (e.g., mapping "Meta" to "Command" on Mac and "Ctrl" on Windows).