#hydration error

34 messages · Page 1 of 1 (latest)

graceful basinBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

slim merlin
#

Can you provide some code or a GitHub repo?

cold mortar
#

sure

#

wait i forgot to git push

#

ok there

#

it only shows when you go to /dashboard

#

i wanted the layout to be different for /dashboard

slim merlin
#

Why /dashboard also contains a html tag? If you want the layouts to be different, you can use route groups.

Therefore, your project structure will be like:

layout.tsx: Root layout, contains providers and html tag
(home)/layout.tsx: Layout of pages under (home), including a navbar/links
(home)/page.tsx: The home page at /
(home)/about.tsx: The about page at /about
(dashboard)/dashboard/layout.tsx: Layout of pages under (dashboard)
(dashboard)/dashboard/page.tsx: The dashboard page at /dashboard

cold mortar
#

Ohhh

cold mortar
#

My layout.js in the app folder

slim merlin
#

Your layouts will be nested, which means the same page contains multiple html tags.

#

that's why you got the error

cold mortar
slim merlin
#

Add the sidebar to your dashboard layout

cold mortar
#

some reason it still shows the navbar

slim merlin
cold mortar
#

do i remove the html and body tag?

slim merlin
#

Remove these tags from where?

cold mortar
#

Nevermind

slim merlin
#

No layouts other than (home)/layout.tsx includes the navbar
(dashboard)/layout.tsx is where you put the sidebar
Read Route Groups for further information

Route Groups can be used to partition your Next.js application into different sections.

cold mortar
#

so do i keep the navbar where it is?

#

im new to next js

slim merlin
cold mortar
#

hhhh

#

ohhh

#

i get it now

#

so i create a folder in the app folder name home

#

and add layout.js

slim merlin
#

it's a route group, you have to wrap the folder name in parenthesis, read the docs above