View Model

In Presto a ViewModel is a class that defines the list of fields & some metadata for some piece of data (eg. a record from a single database table, some data joined from multiple data sources, a form filled out by a user etc).

It's not specific to a backend implementation rather it's concerned with describing what the data is so that a UI can be generated from it & transformations can be done on the data (eg. from user input to specific format or vice versa).

This package provides the core functionality for defining a ViewModel and using them with a ViewModelCache.


Install the packages from npm

yarn add @prestojs/util @prestojs/viewmodel


See the ViewModel getting started guide.