How to render a ServerComponent, that depends on Client State.
Answered
Turkish Angora posted this in #help-forum
Turkish AngoraOP
Am trying to figure out how to use a
getItems(query)
Action, that uses a query
provided by Client Component (zustand).export default async function Page() {
return (<main>
{/* Search Bar that works on whole App */}
<ClientSearchBar /> {/* Uses zustand for `query` and `setQuery` */}
{/* ... */}
{/* Get `query` from zustand store and pass it to `children` */}
<ClientSearchResults>
{/*
Uses `query` to `actionGetSearchResults(query)`
and renders the results
and repeats when `query` changes
*/}
<ServerSearchResults />
</ClientSearchResults>
</main>)
}
Answered by Asian black bear
2 Replies
Answer
Turkish AngoraOP
ty