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

Original URL:
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


Returns: TViewModel

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