@arshazar/react-custom-hooks
v1.0.2
Published
custom hooks for react
Readme
React Custom Hooks
Custom hooks for React to make life easy!
Installation
You can easily install React Custom Hooks by yarn, npm or pnpm.
yarn
yarn add @arshazar/react-custom-hooksnpm
npm i @arshazar/react-custom-hookspnpm
pnpm add @arshazar/react-custom-hooksTable of Hooks
useUpdate
usage: useUpdate(callback, [dependencies])
import { useUpdate } from "@arshazar/react-custom-hooks";
useUpdate(() => {
setSource(images);
}, [images]);useDebounce
usage: useDebounce(value, delay, callback)
import { useDebounce } from "@arshazar/react-custom-hooks";
const debounceValue = useDebounce(value, 1, handleChangeColor);useTimeout
usage: useTimeout(callback, delay)
import { useTimeout } from "@arshazar/react-custom-hooks";
useTimeout(handleFadeAnimation, 200);useThrottle
usage: useThrottle(callback, period, delay)
import { useThrottle } from "@arshazar/react-custom-hooks";
useThrottle(handleChangeCover, 5000, 10);useMobile
usage: useMobile(smallDevicesOnly = false)
import { useMobile } from "@arshazar/react-custom-hooks";
const isMobile = useMobile();useInterval
usage: useInterval(callback, delay)
import { useInterval } from "@arshazar/react-custom-hooks";
useInterval(handleScrollAnimation, 150);useCursorPosition
usage: useCursorPosition()
import { useCursorPosition } from "@arshazar/react-custom-hooks";
const cursorPosition = useCursorPosition();