Skip to content

watchViewModel

Andrei Fangli edited this page Sep 3, 2023 · 2 revisions
API / watchViewModel<TViewModel> hook

DEPRECATED!

In future versions this hook will be removed, switch to useViewModel.


Watches the view model for changes, requesting a render when it does. The view model and watched properties are part of the hook dependencies.

function watchViewModel<TViewModel extends INotifyPropertiesChanged>(viewModel: TViewModel, watchedProperties?: readonly (keyof TViewModel)[])

Template Parameters

Parameters

  • viewModel: TViewModel, The view model to change, a view model is any object that implements INotifyPropertiesChanged.
  • watchedProperties: readonly Array<keyof TViewModel>, optional, a render will be requested when only one of these properties has changed.
Clone this wiki locally