View Model Lookup
ViewModelLookup
, vmLookup
This type is declaration of which data is needed to find your ViewModel instance in ViewModelStore
It can be:
- ViewModel id
ViewModel class reference
React
component created withwithViewModel()
orwithLazyViewModel()
Reference to source code type
Reference to source code with internal usage of this value
Example
This example represents scenario if you are not using API for integration with React.
ts
import { ViewModelStoreBase, ViewModelBase } from "mobx-view-model"
const vmStore = new ViewModelStoreBase();
class MyVM extends ViewModelBase {
constructor() {
super({ id: '1', payload: {} });
}
}
const vm = new MyVM();
...
await vmStore.attach(vm) // this is required thing
...
vmStore.get(vm.id) // instance of MyVM
...