You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-use-rect

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-rect

React hook that measures target element boundaries

0.1.0-alpha.5
Source
npmnpm
Version published
Weekly downloads
1K
-28.49%
Maintainers
1
Weekly downloads
 
Created
Source

react-use-rect

This hook measures a target element boundaries.

It updates the measure once:

  • the target element size changes;
  • the target element or it's ascendant elements scroll;
  • transitions end.

Installation

npm install react-use-rect

Usage

import React from 'react';
import { useRect } from 'react-use-rect';

function Component() {
  const [ref, rect] = useRect();

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

Options

The hook accepts an object of options as it's only argument.

scroll

boolean

default: true

Enables listening to scroll changes.

transitionEnd

boolean

default: true

Enables listening to transition ends.

FAQs

Package last updated on 07 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts