-
Notifications
You must be signed in to change notification settings - Fork 2
useViewModelMemo
API / useViewModelMemo hook
Ensures a view models instance per component generated by the factory and watched for changes. Whenever the provided deps
change a new instance is created, similar to useMemo
.
function useViewModelMemo<TViewModel extends undefined | null | INotifyPropertiesChanged>(
viewModelFactory: ViewModelFactory<TViewModel>,
deps: DependencyList
): TViewModel
Source reference: src/hooks/UseViewModelMemo.ts:21
.
-
TViewModel - The type of view model to create.
Type constraints:
undefined
|null
| INotifyPropertiesChanged.
-
viewModelFactory: ViewModelFactory<TViewModel>
The view model factory callback for creating an instance. -
deps: DependencyList
Dependencies of the callback, whenever these change the callback is called again, similar touseMemo
.
Returns the created view model instance.
Overview
Motivation
Guides and Tutorials - Getting Started
Releases
CodeSandbox
API
Events
IEvent
IEventHandler
EventDispatcher
ViewModels
INotifyPropertiesChanged
ViewModel
Forms
Form
IFormFieldConfig
FormField
ReadOnlyFormCollection
FormCollection
IConfigurableFormCollection
FormSetupCallback
Validation
IValidator
ValidatorCallback
IObjectValidator
IValidatable
Validation / Triggers
WellKnownValidationTrigger
ValidationTrigger
Observable Collection
ReadOnlyObservableCollection
ObservableCollection
INotifyCollectionChanged
CollectionChangeOperation
INotifyCollectionReordered
CollectionReorderOperation
Observable Map
ReadOnlyObservableMap
ObservableMap
INotifyMapChanged
MapChangeOperation
Observable Set
ReadOnlyObservableSet
ObservableSet
INotifySetChanged
SetChangeOperation
Dependency Handling
IDependencyResolver
IDependencyContainer
DependencyContainer
useDependency
useViewModelDependency
useDependencyResolver
React Hooks
useViewModel
useViewModelMemo
useObservableCollection
useObservableMap
useObservableSet