July 2018
Beginner
236 pages
5h 34m
English
The single model type that we have seen so far is just the beginning and can barely be called a tree. We can expand the domain-model to make it more realistic. Let's add a User type, who will be creating the todo items:
import { types } from 'mobx-state-tree';const User = types.model('User', { name: types.string, age: 42, twitter: types.maybe(types.refinement(types.string, v => /^\w+$/.test(v))),});
There are some interesting details in the preceding definition, as follows:
Read now
Unlock full access