Function freya::prelude::ErrorBoundary

pub fn ErrorBoundary(props: ErrorBoundaryProps) -> Option<VNode>
Expand description

Create a new error boundary component.

§Details

Error boundaries handle errors within a specific part of your application. Any errors passed in a child with Throw will be caught by the nearest error boundary.

§Example

rsx!{
    ErrorBoundary {
        handle_error: |error| rsx! { "Oops, we encountered an error. Please report {error} to the developer of this application" }
        ThrowsError {}
    }
}

§Usage

Error boundaries are an easy way to handle errors in your application. They are similar to try/catch in JavaScript, but they only catch errors in the tree below them. Error boundaries are quick to implement, but it can be useful to individually handle errors in your components to provide a better user experience when you know that an error is likely to occur.