use-strict-click-handler
v1.0.5
Published
[![NPM](https://img.shields.io/npm/v/use-strict-click-handler.svg)](https://www.npmjs.com/package/use-strict-click-handler)
Downloads
156
Readme
use-strict-click-handler
Install
npm install --save use-strict-click-handler
Usage
import * as React from 'react';
import useStrictClickHandler from 'use-strict-click-handler';
const Example = () => {
const { handlers } = useStrictClickHandler(() =>
console.log('STRICT CLICKED!')
);
return (
<>
<div className="App" {...handlers}>
<h1>STRICT CLICK</h1>
<ol>
<li>Open console.</li>
<li>Click or drag inside this component.</li>
<li>Drag events are excluded.</li>
</ol>
</div>
<div className="App" onClick={() => console.log('NORMAL CLICKED!')}>
<h1>NORMAL CLICK</h1>
<ol>
<li>Open console.</li>
<li>Click or drag inside this component.</li>
<li>Drag events are included.</li>
</ol>
</div>
</>
);
};
Demo
https://odd-aunt.surge.sh/
License
MIT © ossan-engineer
This hook is created using create-react-hook.