0.2.1 • Published 3 years ago
use-click-with-prevention v0.2.1
Table of Contents
Installation
This module is distributed via NPM which is bundled with NodeJS and should be installed as one of your project's dependencies:
npm install use-click-with-prevention
Usage
import useClickWithPrevention from 'use-click-with-prevention'
const MyComponent = () => {
const singleClick = () => {
// do something
}
const doubleClick = () => {
// do something else
}
// useClickWithPreventio 3rd argument optional = delay: number
const [onClick,onDoubleClick] = useClickWithPrevention(singleClick,doubleClick [,delay]);
return (
<div>
<button onClick={onClick} onDoubleClick={onDoubleClick}>Click Me!</button>
</div>
)
}
🐛 Bugs
Please file an issue for bugs, missing documentation, or unexpected behavior.
LICENSE
MIT