JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 224289
  • Score
    100M100P100Q172977F
  • License MIT

Package Exports

  • @react-hook/throttle

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@react-hook/throttle) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@react-hook/throttle

A hook for throttling values and callbacks.

Installation

yarn add @react-hook/throttle

Usage

import {useThrottle, useThrottleCallback} from '@react-hook/throttle'

const F = props => {
    // basic usage
    const [value, setValue] = useThrottle('initialValue', 30/*fps*/, true/*leading*/)
    
    // this is actually the same code for useThrottle()
    const [state, setState] = useState(initialState)
    const [state, throttledState] = useThrottleCallback(setState, 30/*fps*/, true/*leading*/)
}