ConstError boundary that catches errors from a render function and displays a fallback element.
Suspense boundary for async rendering with loading states.
Renders the fallback while waiting for the async render to complete. Optionally delays showing the fallback to avoid loading flashes on fast responses. Optionally catches errors and renders an error state.
The appropriate SuspenseBoundaryCtx layer (Client, SSR, Hydration) should be provided at the rendering entry point (mount, hydrate, renderToString).
// Suspense boundary for async loading (using @effex/dom)
Boundary.suspense({
render: () => fetchAndRenderData(),
fallback: () => $.div({}, $.of("Loading...")),
catch: (err) => $.div({}, $.of(`Error: ${err}`)),
delay: "200 millis",
})
// Error boundary for catching render errors
Boundary.error(
() => riskyComponent(),
(err) => $.div({}, $.of(`Oops: ${err}`))
)
Boundary namespace for error and async handling.