i have a Tabs-Section (headlessui) and in my Navbar has Links/Buttons for each Tab. My Problem is now that i don't know how i controll the Tabs with the buttons/links in the Navbar. And yes the Tabs are also controlled by the Tab.List.
The Page is structured like this:
<app>
<IndexPage(File)>
<LayoutComponent> // in this component is the navbar-component
{content}
<SectionComponent>
<Tabs.Group>
...
</Tabs.Group>
</SectionComponent>
{content}
<LayoutComponent>
</IndexPage>
</app>
And i tried to handle the TabIndex with react-state (like this) but i don't know how to forward a state through so many components. My second try was with URL-Querys, but this have many bugs, and it worked not really good. Is there a way to solve my Problem?
ps: my project is with nextjs