Is it possible to fetch data using a RSC and pass this data to sibling client components?
Unanswered
XtratoS posted this in #help-forum
XtratoSOP
## Problem:
I have a big component, which has 4 child components,
One of them is a form, so it needs to be a server component so I can use Server Function for fetching data.
I'm really struggling to pass data to siblings of this component, which are the 3 other child components of the big component.
I have a big component, which has 4 child components,
One of them is a form, so it needs to be a server component so I can use Server Function for fetching data.
I'm really struggling to pass data to siblings of this component, which are the 3 other child components of the big component.
17 Replies
American Chinchilla
Why not just seperate the server function
And make the form client
@XtratoS
You can import the server function into the client comp
XtratoSOP
Wait, how would I use a server function in a client component?
American Chinchilla
If you check the next doc it gives an example for server action in client comp
If scroll down to client heading
XtratoSOP
That's very interesting, I think I've started learning next in a really inconvenient time due to the amount of recent changes 😂
Should I mark this as resolved now or after I successfully use it and get it to work?
American Chinchilla
Hmmm im not sure. If your issue is fixed then you can mark it as resolve
XtratoSOP
I'm not sure yet, so once I try I'll come back here
I think server actions are for the data mutation with form actions
I don't think it's for the data fetching
I would recommend fetch data in the server component and pass it to the child component
and set data as global states using redux
and select states from that global state where you need it