Communication between Client component and RSC
Unanswered
Broad-snouted Caiman posted this in #help-forum
Broad-snouted CaimanOP
Hi there!
I've made a client component which is a sidebar with filters. It uses React Context API. On the other hand, I have some glossary terms (currently, ~30 terms, that should slowly grow). For now, I'm storing these terms in .json, since there aren't so many. My question is, is it possible to make a server component in which I read this .json and display the terms filtered by the client component? If so, which are the ways? The only way I thought is to use the URL instead of the Context API.
Thank you!
I've made a client component which is a sidebar with filters. It uses React Context API. On the other hand, I have some glossary terms (currently, ~30 terms, that should slowly grow). For now, I'm storing these terms in .json, since there aren't so many. My question is, is it possible to make a server component in which I read this .json and display the terms filtered by the client component? If so, which are the ways? The only way I thought is to use the URL instead of the Context API.
Thank you!
1 Reply
Broad-snouted CaimanOP
It seems it isn't possible without using search params on the URL. So, I'm thinking in transforming the filters sidebar into RSC, but how would I change the search params? Use
redirect from next/navigation, even though it returns a 3xx status code?