github thebuilder/react-intersection-observer v6.3.0
Hooks!

latest releases: v9.16.0, v9.15.1, v9.15.0...
6 years ago

This release enables support for the useInView(ref, options) hook. The library will work fine with older versions of React, as long as you don't use the execute the hook.

import { useRef } from 'react'
import { useInView } from 'react-intersection-observer'

const Component = () => {
  const ref = useRef()
  const inView = useInView(ref, {
    /* Optional options */
    threshold: 0,
  })

  return (
    <div ref={ref}>
      <h2>{`Header inside viewport ${inView}.`}</h2>
    </div>
  )
}

The release also refactors the Rollup build, which should result in a more optimized bundle.

Don't miss a new react-intersection-observer release

NewReleases is sending notifications on new releases.