UNPKG

mobx-wouter

Version:

<img src="assets/logo.png" align="right" height="156" alt="logo" />

15 lines (14 loc) 535 B
import { withLazyViewModel, } from 'mobx-view-model'; import { createPageVmHocConfig } from '../utils/create-page-vm-hoc-config.js'; export function withLazyPageViewModel(loadFunction, configOrFallbackComponent) { let config; if (typeof configOrFallbackComponent === 'function') { config = createPageVmHocConfig({ fallback: configOrFallbackComponent, }); } else { config = createPageVmHocConfig(configOrFallbackComponent); } return withLazyViewModel(loadFunction, config); }