A library sticky element for ReactJS
npm install --save reactjs-s4y
import Sticky from "reactjs-s4y";
const Page = () => (
<div className="row">
<Sticky offsetTop={20} offsetBottom={20}>
<div>Sidebar</div>
</Sticky>
<div>Content</div>
</div>
);
import {useSticky} from "reactjs-s4y";
const Page = () => {
const stickyRef = useSticky({offsetTop: 20, offsetBottom: 20})
<div className="row">
<aside ref={stickyRef}>
<div>Sidebar</div>
</aside>
<div>Content</div>
</div>
};