-
Notifications
You must be signed in to change notification settings - Fork 2
useViewModelDependency
API / useViewModelDependency hook
This hook has multiple overloads.
Resolves the requested view model dependency and subscribes to it for changes.
This is a utility hook providing the following functionality.
const viewModel = useDependency(viewModelDependency);
useViewModel(viewModel);
function useViewModelDependency<TViewModel extends INotifyPropertiesChanged>(
viewModelDependency: ResolvableSimpleDependency<TViewModel>
): TViewModel
Source reference: src/dependencies/UseViewModelDependency.ts:30
.
-
TViewModel - The view model type to resolve.
Type constraints: INotifyPropertiesChanged.
-
viewModelDependency: ResolvableSimpleDependency<TViewModel>
The view model dependency to resolve.
Returns the resolved view model which is also watched for changes.
- IDependencyResolver
- IDependencyContainer
- ResolvableSimpleDependency<T>
- ConfigurableDependency<T>
- useDependency
- useViewModel
Resolves the requested complex view model dependency and subscribes to it for changes.
This is a utility hook providing the following functionality.
const viewModel = useDependency(viewModelDependency, additionalDependencies);
useViewModel(viewModel);
function useViewModelDependency<TViewModel extends INotifyPropertiesChanged, TAdditional extends readonly any[]>(
viewModelDependency: ComplexDependency<TViewModel, TAdditional>,
additionalDependencies: TAdditional
): TViewModel
Source reference: src/dependencies/UseViewModelDependency.ts:57
.
-
TViewModel - The view model type to resolve.
Type constraints: INotifyPropertiesChanged.
-
TAdditional - A tuple representing additional parameters required by the constructor.
-
viewModelDependency: ComplexDependency<TViewModel, TAdditional>
The view model dependency to resolve. -
additionalDependencies: TAdditional
Additional constructor arguments which also act as dependencies, if one of them changes the view model will be reinitialized.
Returns the resolved view model which is also watched for changes.
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