0.22.0 • Published 3 years ago
@vulppi/react-hooks v0.22.0
Vulppi React Hooks
Installation
npm install @vulppi/react-hooksUsage
import { useTimer } from '@vulppi/react-hooks'
const Component = () => {
const [time, { start, stop, restart }] = useTimer()
return (
<div>
<div>{time}</div>
<button onClick={start}>Start</button>
<button onClick={stop}>Stop</button>
<button onClick={restart}>Restart</button>
</div>
)
}Hooks table
| Hook | Description |
|---|---|
| useBoolean | A hook to create and control a boolean. |
| useClickOutside | A hook to detect click outside of an element. |
| useDebounce | A hook to debounce a function. |
| useDebounceTrigger | A hook to debounce before triggering a function. |
| useInterval | A hook to create and control an interval. |
| useIsMounted | A hook to check if component is mounted. |
| useMediaQuery | A hook to check if media query matches. |
| useMergeRef | A hook to merge multiple refs. |
| useRerender | A hook to force component to rerender. |
| useStateDebounce | A hook to debounce a state. |
| useTimeout | A hook to call function after a timeout. |
| useTimer | A hook to create and control a timer. |
License
MIT © Vulppi