Calling server component function from client component
Answered
Sun bear posted this in #help-forum
Sun bearOP
hey, here is my problem :
I have a folder "about" with a page which holds 2 components : Etiquette (left of screen) and Fiche (right on screen)
I have a server component which calls an API and generates a list of "Etiquette" (id - date - Information) - all this work fine
This server component is wrapped inside a client component to add a onClick
On the right side of the screen, I want to update the "Fiche" component when clicking on a specific Etiquette with the information from this Etiquette (the function would be getSpecificData({idEtiquette}). However, I'd like to keep the API call to get all information of this specific Etiquette on server side (within the about page ?) and I'd like to keep my code split to have a better maintenance of my code
Is it possible ? I've read on docs that it is not possible to give a function as props so I'm looking for another solution and looked around on internet
Maybe I'm forced to have a unique client component to then make the API call and useState ? 😦 (don't mind my awesome visual pls :D)
I have a folder "about" with a page which holds 2 components : Etiquette (left of screen) and Fiche (right on screen)
I have a server component which calls an API and generates a list of "Etiquette" (id - date - Information) - all this work fine
This server component is wrapped inside a client component to add a onClick
On the right side of the screen, I want to update the "Fiche" component when clicking on a specific Etiquette with the information from this Etiquette (the function would be getSpecificData({idEtiquette}). However, I'd like to keep the API call to get all information of this specific Etiquette on server side (within the about page ?) and I'd like to keep my code split to have a better maintenance of my code
Is it possible ? I've read on docs that it is not possible to give a function as props so I'm looking for another solution and looked around on internet
Maybe I'm forced to have a unique client component to then make the API call and useState ? 😦 (don't mind my awesome visual pls :D)
Answered by Sun bear
I solved my "issue" using intercepting routes without using modal but a simple page render 🙂
1 Reply
Sun bearOP
I solved my "issue" using intercepting routes without using modal but a simple page render 🙂
Answer