Previous tip (Need to render a large list of items in your Blazor app?) Next tip (Set multiple parameters in one go with Attribute Splatting) >>

Use Error Boundaries to localise errors

By default an error in your Blazor app will bring down the entire site (and display a global error message).

Use ErrorBoundary to display an error in one part of your app but still leave the rest fully functional.

<h1>Sales Report</h1>
<ErrorBoundary>
<Chart ... />
</ErrorBoundary>
// Renders a chart unless
// an error is thrown, then displays
// "An error has occurred"
// in place of the chart

More details

Check out the official docs for more examples.