@slynch13/usethrottle
v1.1.0
Published
React hook for to throttle functions
Downloads
4
Readme
usethrottle
React hook for to throttle functions
Install
npm install --save usethrottle
Usage
import React, { useState, useEffect } from 'react'
import { useThrottle } from 'usethrottle'
const App = () => {
let [example, setExample] = useState(0)
const throttled = useThrottle((x) => setExample(x), 1000)
useEffect(() => {
throttled(example + 1)
}, [example])
return (
<div>
{example}
</div>
)
}
export default App
License
MIT © slynch13
This hook is created using create-react-hook.