State management with atomic module

Selectors are basically clever getters. They cache their return values.
They only update their return values if an attribute they depend on changes.

The word is taken from redux, but I guess you could think of it as - a selector selects attributes and combines them in some way.

Mobx uses the word compute, as in you re-compute the value if an attribute changes.

In most cases a selector decorator isn’t required (eg in the toy example above it’s not worth caching the value for get_count). It’s most useful for an expensive getter.

1 Like