July 2018
Beginner
236 pages
5h 34m
English
In a data-entry-based application, it is quite common to have forms to accept a variety of fields. In these forms, the original model is not mutated until the user submits the form. This allows the user to cancel out of the editing process and go back to the previous values. A scenario like this requires creating a clone of the original model and pushing the edits upon submit. Although this technique is not terribly complex, it does add some boilerplate.
mobx-utils provides a handy utility called createViewModel() that is tailor-made for this scenario:
viewModel = createViewModel(model)
model is the original model containing observable properties. createViewModel() wraps this model and proxies all the reads and ...
Read now
Unlock full access