dioxus_lib::prelude

Function SuspenseBoundary

source
pub fn SuspenseBoundary(
    __props: SuspenseBoundaryProps,
) -> Result<VNode, RenderError>
Expand description

Suspense Boundaries let you render a fallback UI while a child component is suspended.

ยงExample

fn App() -> Element {
    rsx! {
        SuspenseBoundary {
            fallback: |context: SuspenseContext| rsx! {
                if let Some(placeholder) = context.suspense_placeholder() {
                    {placeholder}
                } else {
                    "Loading..."
                }
            },
            Article {}
        }
    }
}