Sticky header and footer with Next.js
I used React pretty extensively before but I am very new to Next.js and the layout logic doesn’t make much sense to me. From what I understand if layout.js
is under /app
that means that layout applies to the entire application which is exactly what I want. Now, I want to have a header and a footer. Footer should stick to the bottom of the page and header should stick to the top and not be hidden when I scroll. I was able to achieve that by putting my components in page.js
but once I started using routing I realized that’s not the right spot for them and according to the docs they should be in layout.js
instead: