What components should I make "use client"?
Unanswered
Bumble bee posted this in #help-forum

Bumble beeOP
Should I turn Layout-components into client-components? Or how should I structure the whole thing?
Thanks.
Thanks.
13 Replies

Hi, a thing i follow is that everything is a server component, forget client components
When you reach a part where you need interactions, like a button, make it a client component
then back to server components
When you see that your whole page is mostly interactive, dont make the page a client component, make a ClientWrapper in the page and make it a client component, this way nextjs wont yell at you when your whole page is a client component

Bumble beeOP
i wanted my page to be animated with framer-motion

@Bumble bee i wanted my page to be animated with framer-motion

Then create a wrapper component that is client with props for each of the sections to animate. Its just a new way to looking at things 🙂

Well you can watch this, its quite understandable; https://www.youtube.com/watch?v=Qdkg_mrniLk&t=2s

Bumble beeOP
aaaand.... where should I place components? inside app-folder or outside ?

i prefer to hold each component as a folder inside each page folder, not outside, but its your choice actually

@Bumble bee aaaand.... where should I place components? inside app-folder or outside ?

Well basically for me it's based on scope, if a component is for just one page, I put it in there, the more you need it different components you place them in folders which need access to it
An example
I have a home page, and I have a folder for it (home)
Anything specific to the home page only goes in that folder, like cards, groups etc
But it also has a navbar which my whole site uses, so I have a (navbar) folder in the app dir directly
An example
I have a home page, and I have a folder for it (home)
Anything specific to the home page only goes in that folder, like cards, groups etc
But it also has a navbar which my whole site uses, so I have a (navbar) folder in the app dir directly
Its completely your choice though, choose what suits you, for me scoping things is the way I think better so

Bumble beeOP
then do you put components inside a "component" directory or just in place?