Next.js Discord

Discord Forum

Hydrated content into react portal?

Unanswered
Yucatan Vireo posted this in #help-forum
Open in Discord
Yucatan VireoOP
Anyone know of a way to conditionally render page content into a portal?

I want to create a sidebar nav whose internal content changes to content related to a project page. My current solution was to conditionally render a portal root div with Zustand state, then when a page loads, I include a client component in it that sets sidebar state to "project" before rendering a client component with hydrated React Query data into the portal. But this causes obvious race conditions.

0 Replies