This library provides a set of utility functions for working with React components and hooks.
npm install Fasunle/react-utils
The useDebounce
hook is a utility for debouncing a value. It takes two arguments:
value
: The value to debounce.delay
(optional): The delay in milliseconds. Defaults to200
.
Example:
import { useHashRoute } from 'Fasunle/react-utils';
const { hash, changeHash } = useHashRoute();
Register it to a click event or any other trigger as follow:
<button onClick={() => changeHash('/settings')}>Settings</button>