-
Notifications
You must be signed in to change notification settings - Fork 2
useViewModelType
API / useViewModelType<TViewModel> hook
In future versions this hook will be removed, switch to useViewModel.
Ensures a unique instance per component of the given type is created and watches the view model for changes. Returns the view model instance.
function useViewModelType<TViewModel extends INotifyPropertiesChanged>(viewModelType: ViewModelType<TViewModel>, watchedProperties?: readonly (keyof TViewModel)[]): TViewModel
- TViewModel: the type of view model to create. Must implement INotifyPropertiesChanged.
- viewModelType: ViewModelType<TViewModel>, the view model type to initialize.
-
watchedProperties:
readonly
Array<keyof
TViewModel>, optional, a render will be requested when only one of these properties has changed.
Returns the initialized view model instance, unique per component lifecycle.
Motivation
Overview
Guides and Tutorials - Getting Started
Releases
API
Events
IEvent
IEventHandler
INotifyPropertiesChanged
INotifyCollectionChanged
IItemAddedEventArgs
IItemRemovedEventArgs
ICollectionChange
ItemRemovedCallback
ICollectionChange
EventDispatcher
Observable Collections
IReadOnlyObservableCollection
IObservableCollection
ReadOnlyObservableCollection
ObservableCollection
ViewModels
ViewModel
isViewModel
Forms
IFormFieldViewModel
IFormFieldViewModelConfig
FormFieldViewModel
FormFieldCollectionViewModel
FormFieldSet
DynamicFormFieldCollectionViewModel
Validation
IReadOnlyValidatable
IValidatable
IValidationConfig
ValidatorCallback
CollectionItemValidatorCallback
ValidatableSelectorCallback
ValidationConfigSelectorCallback
UnsubscribeCallback
registerValidators
registerCollectionValidators
registerCollectionItemValidators
React Hooks
EventHandler
useEvent
ViewModelType
ViewModelFactory
useViewModel
useViewModelMemo
useObservableCollection
useValidators
useCollectionValidators
useCollectionItemValidators