Deriving Data from State

Learn how views help in deriving data from the state.

We’ve mentioned the fact that MobX’s authors state that anything that can be derived from state should be. We’ll get a chance to derive some data now.

View for the store model

We would like to know which images are liked and which are not so that we can successfully add them to the list of liked images or avoid duplicating them. Deriving data from the state is done on the data models through views. We’ve decided to add the following view to the store because we are working in a constrained environment, and we want to keep things simple.

Here’s the view that we have added to the RootStore model:

Get hands-on with 1200+ tech skills courses.