Next.js : Get server component data in client component
Hey, I'm trying the new app dir. It's pretty good, but I'm not sure how to get data from a server component and pass it to my XState machine? 🧐
For now the only way I found is to do it like this
4 Replies
You want your machine to be inside a client component.
https://nextjs.org/docs/getting-started/react-essentials#client-components
Getting Started: React Essentials
An overview of essential React features for building Next.js Applications, including Server Components.
Okay so I will be able to do some props drilling between my layout file which is a server component and my client component ?
Yep, you can send serializable props from server to client components
aaah nice! Thank you 👍