Next.js Discord

Discord Forum

Understand routing for direct route and keeping context

Unanswered
American Sable posted this in #help-forum
Open in Discord
American SableOP
I am just trying to understand how to handle certain situations. If I create a new route from / say /user, if I put a layout in there it can have a direct link go to it. But Going back to the main page errors out being in a different context because the html layout is in both. If this was a client side only app that makes sense. But how do I allow routes directly to /user, and have them able to click to go back to /? Or maybe I am misunderstanding a fundemental and I shouldn't have this setup. Would love to know more.

2 Replies

sorry. i don't understand the question.
American SableOP
That's ok thanks for replying. I am getting a context error when I have a layout with an html in sub paths say /dashboard, but the root also has a layout with html. When I go to the sub path, and then go back. Which makes sense, it's technically two different roots or instances of react. But if I remove the layout, then I can't go directly to that page as it also has no context. So I am wondering how to accomplish both.