1.0.5 • Published 3 years ago

use-strict-click-handler v1.0.5

Weekly downloads
139
License
MIT
Repository
github
Last release
3 years ago

use-strict-click-handler

NPM

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.

1.0.5

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

0.1.0

4 years ago