Next.js Discord

Discord Forum

How can I have a client component update an RSC?

Answered
Siberian posted this in #help-forum
Open in Discord
SiberianOP
I have a server component page that has a client component in it for display and interactivity. This page displays a list of items and allows the user to delete an item by clicking a delete button. When the item is deleted, the server component should reload the data from the data source. Do I have to do a router.refresh() and refresh the whole page or can I just refresh the component? Any code examples would be great.
Answered by Giant panda
Refreshing the entire router is the way to do it client-side. Otherwise use a server action combined with revalidatePath to re-run the RSC.
View full answer

2 Replies

Giant panda
Refreshing the entire router is the way to do it client-side. Otherwise use a server action combined with revalidatePath to re-run the RSC.
Answer
SiberianOP
Hmm, okay I'll have to look into server actions then. Thanks.