rescript-throttle-react

Throttle hooks for @rescript/react

Usage no npm install needed!

<script type="module">
  import rescriptThrottleReact from 'https://cdn.skypack.dev/rescript-throttle-react';
</script>

README

rescript-throttle-react

version license build

Throttle hooks for @rescript/react.

Installation

# yarn
yarn add rescript-throttle-react
# or npm
npm install --save rescript-throttle-react

Then add it to bsconfig.json:

"bs-dependencies": [
  "rescript-throttle-react"
]

Usage

// With default timeout (100ms)
let fn = ReactThrottle.useThrottled(fn)

// With configured timeout
let fn = ReactThrottle.useThrottled(~wait=250, fn)

// Controlled hook
let fn = ReactThrottle.useControlled(fn)

See rescript-throttle for more details.

License

MIT.