A lot of times I need to manage a global state for my apps and ended using someone else solution without realizing that React offer me everything I need for this, so I did some research and found a lot of React-only solutions and ended creating my own global-state handler.
What it does
This handle a global state (like Redux) using just
useReducer hook and a custom hook.
How I built it
Try and error was my best friend, also a lot of experimentation.
Challenges I ran into
Find a good and flexible solution was the hard part, also understanding React Context, now I think I love it.
Accomplishments that I'm proud of
Doing my own solution and see it working as I expected, also the quantity of lines, It's a pretty simple solution.
What I learned
- How to create my own react hook
- How React Context works and how to use
What's next for Managing a global state just using React
- Make a library of it and make it open source
- Look into others solutions to improve it