useViewModelType - Andrei15193/react-model-view-viewmodel Wiki

Original URL: https://github.com/Andrei15193/react-model-view-viewmodel/wiki/useViewModelType
API / useViewModelType<TViewModel> hook

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

Template Parameters

Parameters

Returns: TViewModel

Returns the initialized view model instance, unique per component lifecycle.