Is it a side effect?
In Chapter 1, Introduction to State Management, we talked about the role of side effects. These are the reactive aspects of the application that produce external effects based on changes in state (also known as data). If we now look at computed properties through the lens of side effects, you can find it very similar to the reactions in MobX. After all, a reaction in MobX looks at observables and produces side effects. This is what a computed-property does too! It depends on observables and produces an observable-value as side effect. So, shouldn't computed properties be considered as side effects?
Very sound argument indeed. It can appear as a side effect from the way it is derived, but the fact that it generates an ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access