Skip to content
React Intersection Observer
Esc
navigateopen⌘Jpreview
On this page

Rework some internals

Potential breaking change #195

Change for the <InView>

Previously, the initial callback would trigger a state update, even if the element was still outside the viewport. This update changes the behavior, so it won’t trigger new state update before the element enters the viewport.

If you used the IntersectionObserverEntry during that first callback, it will no longer work. The use case for this, is most likely to determine if the element started outside the viewport.

Workaround

As a workaround, you can use the onChange callback, since this will still be called everytime.

Last updated on March 11, 2019

Was this page helpful?