React Sticky Children

imkevdev

Kevin Farrugia

Posted on March 7, 2022

React Sticky Children

I created a simple ReactJS plugin react-sticky-children to abstract away the complexities of the IntersectionObserver API and allow you to apply styles to a component as it approaches the top of the viewport. Useful for "Scroll to Top", complex "sticky" elements or animating components into view.

Demo

Demo

Usage

import { ReactStickyChildren } from 'react-sticky-children';

<ReactStickyChildren initialStyle={initialStyle} intersectingStyle={intersectingStyle}>
  <MyComponent />
</ReactStickyChildren>
Enter fullscreen mode Exit fullscreen mode

Looking for feedback. 🙏

NPM: https://www.npmjs.com/package/react-sticky-children
GitHub: https://github.com/kevinfarrugia/react-sticky-children

💖 💪 🙅 🚩
imkevdev
Kevin Farrugia

Posted on March 7, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Unleashing Million.js v2.0.0
react Unleashing Million.js v2.0.0

March 10, 2023

React Sticky Children
react React Sticky Children

March 7, 2022

macOS themed Portfolio website
react macOS themed Portfolio website

June 17, 2021

How to move to react-query v1
react How to move to react-query v1

March 2, 2020