@greenlabs/rescript-use-debounce
v9.0.0
Published
ReScript bindings for rescript-use-debounce
Downloads
3
Readme
rescript-use-debounce
Binding of use-debounce
package
Install
npm i @greenlabs/rescript-use-debounce
or
yarn add @greenlabs/rescript-use-debounce
"bs-dependencies": [
"@greenlabs/rescript-use-debounce"
]
Usage
let test = () => {
let (debouncedCallback, debouncedCallbackMethods) = useDebouncedCallback(e => {
e->ReactEvent.Synthetic.preventDefault
}, 500, ~options={maxWait: 500})
(debouncedCallback, debouncedCallbackMethods.isPending())
}
Note
flush()
's type signature is unit => ReturnType<callback>
, but couldn't find a way to achieve it in ReScript so left the return type as unit.