Sometimes you need to react to changes to state. Typically you want to run some imperative logic related to something in the state changing.
// Access and return some state to react to
// Do something with the returned value
// If you return an object or array from the state you can set this to true.
// The reaction will run when any nested changes occur as well
// Runs the reaction immediately
There are two points of setting up reactions in Overmind.
The onInitializeOvermind action is where you set up reactions that lives throughout your application lifetime. The reaction function returns a function to dispose it. That means you can give effects the possibility to create and dispose of reactions in any action.