If you have a tree with a node that has a property
P, and all of its parents also need to have property
P is contagious.
When can that happen?
Derived state for frontend applications comes up a lot. State
B depends on State
A, so after you update
A, by the time you read
B you want it to be updated based on the latest value of
A. There’s a bunch of ways to model this, involving different tradeoffs:
A popular solution is selector libraries like Reselect. The way they work is: