mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-26 22:20:19 +00:00
28 lines
490 B
Rust
28 lines
490 B
Rust
use dioxus::{core::CapturedError, prelude::*};
|
|
|
|
fn main() {
|
|
dioxus_desktop::launch(App);
|
|
}
|
|
|
|
#[component]
|
|
fn App(cx: Scope) -> Element {
|
|
cx.render(rsx! {
|
|
ErrorBoundary {
|
|
handle_error: |error: CapturedError| rsx! {"Found error {error}"},
|
|
DemoC {
|
|
x: 1
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
#[component]
|
|
fn DemoC(cx: Scope, x: i32) -> Element {
|
|
let result = Err("Error");
|
|
|
|
result.throw()?;
|
|
|
|
render! {
|
|
h1 { "{x}" }
|
|
}
|
|
}
|