Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use useContext and useState hooks to provide global state #2

Closed
Dgarc359 opened this issue Aug 7, 2022 · 2 comments · Fixed by #7
Closed

use useContext and useState hooks to provide global state #2

Dgarc359 opened this issue Aug 7, 2022 · 2 comments · Fixed by #7

Comments

@Dgarc359
Copy link
Owner

Dgarc359 commented Aug 7, 2022

I don't want to use redux, I think I can just use a combination of useContext and useState in order to pass around the following states:

  • whether or not a user has logged in
  • dark / light mode
  • (Optional?) Current color scheme -- This one may or may not be necessary because each page has their own color scheme, not sure if global context is the place to set it, but maybe... -- I do like this idea though because we can have a global setter without having to repeat the logic... maybe I can just turn this into a hook called useColorScheme?
Dgarc359 added a commit that referenced this issue Aug 10, 2022
… should be its own branch but i got excited...
Dgarc359 added a commit that referenced this issue Aug 10, 2022
… should be its own branch but i got excited...
@Dgarc359 Dgarc359 changed the title use useContext and useState hooks to provide global login state use useContext and useState hooks to provide global state Aug 13, 2022
@Dgarc359
Copy link
Owner Author

@Dgarc359
Copy link
Owner Author

In regards to color scheme, I will be moving forward with using useContext to manage this. I want the footer component to use the color scheme set by the global context, and I want each page to access the global setter and set their color scheme that way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant