React hook for handling double tap on mobile devices
- Detect double tap on mobile devices
- Adjustable detection threshold
- Callback for single tap
yarn add use-double-tap
or
npm install --save use-double-tap
import React from 'react'; // No longer necessary in newer React versions
import { useDoubleTap } from 'use-double-tap';
export const Example = () => {
const bind = useDoubleTap((event) => {
// Your action here
console.log('Double tapped');
});
return <button {...bind}>Tap me</button>;
}
Full documentation can be found here
If you like my work, consider making a donation through Github Sponsors.
MIT © minwork