Skip to main content

withViewModel

Callable

  • withViewModel<TViewModel>(viewModelDeclaration: ViewModelDeclaration<TViewModel, ViewControllerContext<InferViewModelProps<TViewModel>>>): <TComponentProps>(ViewComponent: React.ComponentType<PropsWithChildren<TComponentProps>>) => InferHocComponent<TViewModel, TComponentProps>

  • Creates a higher-order React component that provides a view model for a given view component.


    Type parameters

    Parameters

    Returns <TComponentProps>(ViewComponent: React.ComponentType<PropsWithChildren<TComponentProps>>) => InferHocComponent<TViewModel, TComponentProps>

      • <TComponentProps>(ViewComponent: React.ComponentType<PropsWithChildren<TComponentProps>>): InferHocComponent<TViewModel, TComponentProps>
      • Type parameters

        • TComponentProps: { viewModel: TViewModel }

        Parameters

        • ViewComponent: React.ComponentType<PropsWithChildren<TComponentProps>>

        Returns InferHocComponent<TViewModel, TComponentProps>