/use-raf-debounced-value

A react hook that provides value debouncing using requestAnimationFrame.

Primary LanguageJavaScript

useRafDebouncedValue react hook

A react hook that provides value debouncing using requestAnimationFrame.

Installation

Yarn:

yarn add use-raf-debounced-value

Npm:

npm i use-raf-debounced-value --save

Usage

import { useRafDebouncedValue } from 'use-raf-debounced-value';
import { useExampleHook } from 'example';

export const useDebouncedExampleHook = () => {
  const value = useExampleHook();
  const [debouncedValue] = useRafDebouncedValue(value);

  return debouncedValues;
};