More mobx-state-tree Types: map, literal, union, and enumeration

Share this video with your friends

Send Tweet

It is time to give our wishlist app some more depth. In this lesson, we will introduce the concept of groups and users. So that we can manage multiple users inside a group that can have a wishlist. Also, we will take a quick look at powerful features like union types and type discrimination.

In this lesson you will learn:

  • Using the type map to store data by key
  • Using literals to create single value types
  • Combining literals and unions to do type discrimination
  • Using Quokka as scratchpad for quick coding experiments
  • Using enumerations
  • Enumerations are just sugar for a union of literals
Alan Plum
~ 6 years ago

This is probably not the most politically appropriate example to use for unions, to be perfectly honest.