DEV Community

loading...

Discussion on: Create section navigation with React and Intersection Observer

Collapse
sebastiangraz profile image
Sebastian Grąz

Hi Maciek, thanks for the write-up! It helped me a lot in getting started with IO + hooks. In my own implementation I found a way to make the rootMargin configuration simpler than using a 1px pixel window height listener. While achieving the same thing.

{
  rootMargin: "-50% 0px -50% 0px",
  threshold: 0,
}

Hope this helps someone else stumbling upon this post.

Collapse
maciekgrzybek profile image
Maciek Grzybek Author

Oh wow, that's way better than my approach :) Awesome stuff, thanks :) BTW - great designs mate :)