useViewModelDependency - Andrei15193/react-model-view-viewmodel GitHub Wiki
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:135
.
-
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.