Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 397 Bytes

useHover.md

File metadata and controls

25 lines (19 loc) · 397 Bytes

useHover

React sensor hook that tracks size of some HTML element.

Usage

import {useHover} from 'react-use';

const Demo = () => {
  const element = (hovered) =>
    <div>
      Hover me! {hovered && 'Thanks!'}
    </div>;
  const [hoverable, hovered] = useHover(element);

  return (
    <div>
      {hoverable}
      <div>{hovered ? 'HOVERED' : ''}</div>
    </div>
  );
};