@loyhooks/use-hover

1.0.0 • Public • Published

@loyhooks/use-hover

React Hook to detect a hover on an any React Element

Installation

yarn

yarn add @loyhooks/use-hover

npm

npm i @loyhooks/use-hover

Usage

import React from "react";
import useHover from "@loyhooks/use-hover";

function App() {
  const onHover = () => console.log("Somebody hovered!");
  const markedRef = useClick(onHover);
  return <h1 ref={markedRef}>Hello Nooks</h1>;
}

Arguments

Argument Type Description Required
onHover function Function to be called when the element is hovered yes

Return

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @loyhooks/use-hover

      Weekly Downloads

      0

      Version

      1.0.0

      License

      MIT

      Unpacked Size

      2.25 kB

      Total Files

      4

      Last publish

      Collaborators

      • loy124