1.1.0 • Published 5 years ago

@slynch13/usethrottle v1.1.0

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

usethrottle

React hook for to throttle functions

NPM JavaScript Style Guide

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.

1.1.0

5 years ago

1.0.0

5 years ago