Now Playing Mario

    @jacob-hooks/use-click

    1.0.3 • Public • Published

    @jacob-hooks/use-click

    React Hook to execute a function when the mouse click then add event listener

    installation

    yarn

    yarn add @jacob-hooks/use-click

    npm

    npm i @jacob-hooks/use-click

    Usage

    import React from "react";
    import useClick from "@jacob-hooks/use-click";
    
    const App = () => {
      const sayHello = () => console.log("Say Hello");
    
      const title = useClick(sayHello);
    
      return (
        <div className="App">
          <h1 ref={title}>Hello</h1>
        </div>
      );
    };

    Arguments

    Argument Type Description Required
    click string The mouse click then add event lister yes

    Install

    npm i @jacob-hooks/use-click

    DownloadsWeekly Downloads

    0

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    3.89 kB

    Total Files

    6

    Last publish

    Collaborators

    • jacobko