To create a sustainable architecture for your Immutable.js code, you need a component that handles a few things:
- It encapsulates the entire application state as one nested Immutable.js collection
- It provides a mechanism for changing the application state by passing in a new Immutable.js collection
- It runs side-effect functions every time the state changes
Such a component would be generic and useful enough so that you could use it in all of your Immutable.js applications. The idea is to enforce consistent side-effect behavior in response to state changes. Let's implement this component now.