0.0.7 • Published 5 years ago

use-throttled-effect v0.0.7

Weekly downloads
439
License
MIT
Repository
github
Last release
5 years ago

useThrottledEffect react hook

Install it with yarn:

yarn add use-throttled-effect --save

Or with npm:

npm i use-throttled-effect --save

#Example

import React, { useState } from 'react';
import useThrottledEffect  from 'use-throttled-effect';

export default function Input() {
  const [count, setCount] = useState(0);

  useEffect(()=>{
    const interval = setInterval(() => setCount(count=>count+1) ,100);
    return ()=>clearInterval(interval);
  },[])
  
  useThrottledEffect(()=>{
    console.log(count);     
  }, 1000 ,[count]);
  
  return (
    {count}
  );
}
0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago