Suspense

Bemtv has a special syntax to use the feature of suspending the visualization of a component while it is being imported/loaded:

import { _ } from "bemtv";

const { template } = _`App`();

template`UserData[](Loading...)`;

Note the (Loading...) right after the component brackets, this tells Bemtv to render the content inside the () while the UserData() component is not available, we can use any valid value as a template inside the () like for example a component.

Suspense component syntax fallback takes precedence over lazy component fallback.

If the component is a lazy component, Bemtv will import it automatically as soon as the component is requested in a template.

Last updated