@sook/use-hover

1.1.0 • Public • Published

@sook/use-hover

React Hook to detect a hover on an any React Element

Installation

yarn

yarn add @sook/use-hover

npm

npm i @sook/use-hover

Usage

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

function App() {
  const onHover = () => console.log("Somebody hovered!");
  const markedRef = useClick(onHover);
  return <h1 ref={markedRef}>Hello sook</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

Package Sidebar

Install

npm i @sook/use-hover

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

2.2 kB

Total Files

4

Last publish

Collaborators

  • sangriaholic