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

API / useViewModelFactory<TViewModel> hook

Ensures a unique instance per component that is generated by the factory is created and watches the view model for changes. Returns the view model instance.

function useViewModelFactory<TViewModel extends INotifyPropertiesChanged>(viewModelFactory: ViewModelFactory<TViewModel>, watchedProperties?: readonly (keyof TViewModel)[]): TViewModel

Template Parameters

Parameters

Returns: TViewModel

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