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.