#How to Handle Server-Side Data Fetching with Search Params for Globally Available Component

1 messages · Page 1 of 1 (latest)

tiny elk
#

I have a <SearchTokensDrawer /> component that was previously a client component in my rootLayout to provide global search. Now I want to move data fetching to a server component and pass the result to the client. However, since searchParams are only available in page components (not layouts), I can’t keep this logic in rootLayout anymore. What’s the best practice to make this component globally available without duplicating logic in every page?