Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 548 Bytes

useThrottle.md

File metadata and controls

30 lines (23 loc) · 548 Bytes

useThrottle and useThrottleFn

Vue hooks that throttle.

Usage

import { useThrottle, useThrottleFn, useState } from 'vue-next-use';

const Demo = {
  setup(){
      const throttledValue = useThrottle(value);
      // const throttledValue = useThrottleFn(value => value, 200);

      return () => (
          <>
              <div>Value: {value}</div>
              <div>Throttled value: {throttledValue}</div>
          </>
      );
  }
};

Reference

useThrottle(value, ms?: number);
useThrottleFn(fn, ms, args);