Skip to content

How to store global state with providers? #1108

Closed Answered by SzabKel
SzabKel asked this question in Q&A
Discussion options

You must be logged in to vote

The first example did not work, because I set the global value where I declared the Provider with the scope. I needed to create a new parent component, declare the Provider there and only set the values in child components.

Fixed, single file example: https://stackblitz.com/edit/react-ts-ddqoms?file=Hello.tsx

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SzabKel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant