Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 537 Bytes

useHover.md

File metadata and controls

33 lines (23 loc) · 537 Bytes

useHover

Tracks your hover state on the specific element with this hook!

Usage

import { useHover } from 'use-haki';

const App = () => {
  const [ref, isHovered] = useHover();

  return (
    <section>
      <h1 ref={ref}>{isHover ? 'Hi there 👋' : 'Can someone hover me 😧?'}</h1>
    </section>
  );
};

Reference

const [ref, isHovered] = useHover('path');
  • ref - reference to element that need to be hover
  • isHovered - hover state (true/false)

Returns

  • ref
  • isHovered