TIL - State Management In React & Redux
February 06, 2020
What follows is notes from a class. Incomplete thoughts & code that probably will only make sense to me. Given enough time, even that may be a stretch! Reference at your own risk π
Slides
Why Manage State
We went through a few examples of difficult things about state:
- prop drilling is annoying
- you can lose your state if you change pages and the components are destroyed
So you can use the React Context API
Another way to manage state: unstated. Itβs more robust than the Context API but less guns-blazing than Redux. There are lots of ways people have managed state over time.
Redux is the big banger
Slides
Every store has management software which is the only thing that can change the state of that store. This management software is called a reducer.
Actions are the code we write which are fed to the reducers to affect state.