useInView

UseInView is an intersection observer hook. I use the react-intersection-observer library. Don't reinvent the wheel. 😀

Values

ref:

The element that is being watched

inView:

Boolean value whether the element is in view

entry:

access to all the details about the current intersection state

Arguments

root:

The Element that is used as the viewport for checking visibility of the target.

rootMargin:

Margin around the root.

threshold:

Number between 0 and 1 indicating the percentage that should be visible before triggering.

triggerOnce:

Only trigger this method once