Next.js Discord

Discord Forum

How to pass config to layout

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
So I have a layout that has navbar and this navbar is scrollable. I want the scroll to be persisted between pages so it has to be kept in Layout.
On some pages I want to hide some parts of this layout.
Currently I use context to set layout mode and Layout renders corresponding elements.
There's a problem with that so that during loading default layout mode is visible. Also I don't think this approach will work well with server components.

So tl;dr is there a way to pass some data from page to shared layout?

0 Replies