Nuclear Powered Marshmallows

    @ej-hooks/use-click

    1.0.0 • Public • Published

    @ej-hooks/use-click

    React Hook to detect a click on an any React Element

    Installation

    yarn

    yarn add @ej-hooks/use-click

    npm

    npm i @ej-hooks/use-click

    Usage

    import React from 'react';
    import useClick from '@ej-hooks/use-click';
    function App() {
      const onClick = () => console.log('Somebody clicked!');
      const makedRef = useClick(onClick);
      return <h1 ref={makedRef}>Hello Hooks</h1>;
    }

    Arguments

    Argument Type Description Required
    onClick function Function to be called when the element is clicked yes

    Return

    Return value Type Description Default value
    ref React Ref A React Ref listening to the click event, add it to any element null

    Install

    npm i @ej-hooks/use-click

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    2.21 kB

    Total Files

    4

    Last publish

    Collaborators

    • eunjinfizz