New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@stackmeister/react-use-intersection-observer

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stackmeister/react-use-intersection-observer

@stackmeister/react-use-intersection-observer =============================================

latest
Source
npmnpm
Version
0.1.5
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

@stackmeister/react-use-intersection-observer

A hook that wraps around the DOM IntersectionObserver.

With it you can check things like "for how many percent is this element in that element" or "am I scrolled half over this element".

Install

// Yarn
yarn add @stackmeister/react-use-intersection-observer

// NPM
npm i @stackmeister/react-use-intersection-observer

TypeScript typings are included (No @types/ package needed)

Usage

import useIntersectionObserver from '@stackmeister/react-use-intersection-observer'

const App = () => {
  const { ref, entry } = useIntersectionObserver()

  // entry =
  // {
  //   boundingClientRect: DOMRect,
  //   intersectionRatio: number,
  //   intersectionRect: DOMRect,
  //   isIntersecting: boolean,
  //   rootBounds: DOMRect,
  //   time: number,
  // }

  return (
    <div ref={ref}>
      ...
    </div>
  )
}

FAQs

Package last updated on 09 Nov 2022

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