Sticky Sidebar in React

Tagged: reactcss
Photo by Pixabay from Pexels
Photo by Pixabay from Pexels

How to do it

Now you could use something like react-sticky to do something like this, but it’s so much easier to just define your sidebar using css.

#sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: 0;

You can change the top position to be any amount that would include your fixed header if you wanted to.

Profile picture

Written by who lives and works in Wisconsin building useful things, and thinks that pineapple on pizza is okay. You should follow them on Twitter