TypeScript edition! 🎉
I decided to switch the project from Flow to TypeScript. This should ensure the TypeScript definitions match the actual implementation, without the need to manually sync the index.d.ts
file.
In the process, i've rewritten some of the internals, but it shouldn't affect the actual API.
A documentation site has also been created using docz: https://react-intersection-observer.now.sh
Breaking changes
- The deprecated
render
method has been removed - Make sure you usechildren
instead. - Instead of returning just
intersectionRatio
, you now getentry
that contains the entireIntersectionObserverEntry
element. If you're relying onintersectionRatio
, you should change your code toentry.intersectionRatio
. rootId
has been removed - An idea for each unique root is now auto generated. This always felt like temporary solution, until i implemented a smarter way.- Flow types have been removed.