Next.js Discord

Discord Forum

layout.js not being created automatically?

Unanswered
Asian black bear posted this in #help-forum
Open in Discord
Asian black bearOP
Hello, I was following the beginner guide in the docs here https://nextjs.org/learn/react-foundations/installation and neat the bottom it says that on the first run, a layout.js will be automatically created in my app folder, but there wasnt any. Do you guys know why?

5 Replies

Asian black bearOP
@Asian black bear Click to see attachment
Cinnamon Teal
Not sure about how the layout file was not created, but this useState error is most probably because you have not added the use client directive at the top of the page file you are importing the useState hook in.

It actually mentions just below the above error message.
Asian black bearOP
yeah the error is alright
getting this error now that i changed the LikeButton to a client component, assuming cus im missing the layout.js
yea i just manually created it and its fixed.. idk why it didnt generate it