Help with global state

I've fallen down one too many rabbit holes and could use some help.

I have a number of toggle buttons on my website, and I need to know which are selected. I need to know this selection data on a few of my components, so I am trying to find a way to save this state.

I've tried making a context, but none of the examples I could find compile. I tried sessionStorage which would save the old state on reload, which duplicated values. Still pretty new with nextjs/react/typescript.

I am using the shadcn Toggle component, and I need to know which of my toggles are selected in the client.
Was this page helpful?