Skip to content

Instantly share code, notes, and snippets.

@captain-woof
Created September 26, 2021 09:49
Show Gist options
  • Select an option

  • Save captain-woof/3942dc46e60ac7e4f3a9377801cf83fa to your computer and use it in GitHub Desktop.

Select an option

Save captain-woof/3942dc46e60ac7e4f3a9377801cf83fa to your computer and use it in GitHub Desktop.
React Intersection Revealer Quick Start Example
import React, {useRef} from 'react'
import {useIntersectionRevealer} from 'react-intersection-revealer'
export default function YourAwesomeComponent(){
const ref = useRef()
const {heightVisible} = useIntersectionRevealer(ref)
return(
<>
<div className="need-to-track" ref={ref}>...</div>
<p>{`${heightVisible}px (height) of the tracked element is on screen`}</p>
</>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment