Skip to content

slynch13/useThrottle

Repository files navigation

usethrottle

React hook for to throttle functions

NPM JavaScript Style Guide

Install

npm install --save @slynch13/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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •