1.0.6 • Published 6 years ago

@softbind/hook-use-measure v1.0.6

Weekly downloads
257
License
MIT
Repository
github
Last release
6 years ago

useMeasure

Installation

npm i @softbind/hook-use-measure --save

API

useMeasure(ref, types)

Arguments

  • ref: HTMLElement: ref is a HTMLElement returned from useRef hook.
  • types: string | Array<string>: types of info that you would like to fetch from dom. Available types: ['client', 'offset', 'scroll', 'bounds', 'margin']

Returns

  • measure: Object: Current measure info based on provided types arg.
import { useMeasure } from "@softbind/react-hooks";

const MyComponent = () => {
  const ref = useRef(null);
  const { bounds } = useMeasure(ref, "bounds");

  console.log(bounds);

  return <div ref={ref}>Test</div>;
};
1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago