Difference between server/client components? When to use?

I kind of just wanted to know when some good practices are when it came to using server/client components. First time using Next and I sometimes see people creating like a seperate api directory or something like that. If there's any resources you know that are helpful that would be awesome
6 Replies
Neto
Neto11mo ago
server components are meant to create "pure html" elements with no state nor anything client related (like useState, useEffect)
BigBellyBigDreams
@nyx (Rustular DevRel) ohhh so its like logical components basically
Neto
Neto11mo ago
Astro Documentation
Astro Islands
Astro Islands (aka Component Islands) are a pattern of web architecture pioneered by Astro. “Islands architecture” was first coined by Etsy's frontend architect Katie Sylor-Miller in 2019, and expanded on by Preact creator Jason Miller.
Neto
Neto11mo ago
look this astro doc no js -> (kinda) server component js -> client component
BigBellyBigDreams
makes sense, so on my client components it should be pure html and all my state handling / logic is contained in the server component and in that case server components are not "rendered" right or are they?
Neto
Neto11mo ago
server components are meant to give you "pure html" that is the point of the await and suspense
Want results from more Discord servers?
Add your server
More Posts
How to store image path in database?I use S3 compatible service: Storj for storing my images. So when you upload file you get bucket namOpinion on DX of this code, is it too confusing or easy to grasp?```ts const roles = makeEnum("User", "Admin", "Owner"); // Type: "User", "Admin", "Owner" export typHow can I use login with username and password using NextAuth from T3-App?I want to implement a custom login with username and password while storing data like username and ptesting frameworks that work best with next 13 and the app router?I'm interested in performing tests ("preferably integration") on entire app router pages. I'm havingResend Emailhey, I'm created an enquiries page for people to send an email to the enquiries email address, I wandoes anyone have a create-t3-app and shadcn starter repo?I'm trying to install create-t3-app and then shadcn on top of that. However running into styling eBackend equivalent to Create T3 AppHi everyone, is there a backend equivalent to create T3 app for example with express/typescript/esliCannot find module error in building turbo repoHi, I am new to using turborepo. When I try to deploy my project from apps folder I keep getting thenextauth google provider not properly creating accountI have deployed my app to vercel and configured my environment variables, however I always get theseDeployed default nextjs app on vercel - doesn't have perfect "Real Experience Score", why?To test out vercel I deployed default nextjs app, why it doen't have perfect Real Experience score t