fix RuntimeError message formatting
This commit is contained in:
1 parent
d07e81005f
commit
9479d2376d
1 file changed
+7
-7
@@ -334,19 +334,19 @@ use dioxus::prelude::*;
|
|||||||
static COUNT: GlobalSignal<i32> = Signal::global(|| 0);
|
static COUNT: GlobalSignal<i32> = Signal::global(|| 0);
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
fn MyComponent() -> Element {
|
fn MyComponent() -> Element {{
|
||||||
use_effect(|| {
|
use_effect(|| {{
|
||||||
// Grab the runtime from the MyComponent scope
|
// Grab the runtime from the MyComponent scope
|
||||||
let runtime = Runtime::current().expect(\"Components run in the Dioxus runtime\");
|
let runtime = Runtime::current().expect(\"Components run in the Dioxus runtime\");
|
||||||
// Move the runtime into the web-sys closure scope
|
// Move the runtime into the web-sys closure scope
|
||||||
let web_sys_closure = Closure::new(|| {
|
let web_sys_closure = Closure::new(|| {{
|
||||||
// Then create a guard to provide the runtime to the closure
|
// Then create a guard to provide the runtime to the closure
|
||||||
let _guard = RuntimeGuard::new(runtime);
|
let _guard = RuntimeGuard::new(runtime);
|
||||||
// and run whatever code needs the runtime
|
// and run whatever code needs the runtime
|
||||||
tracing::info!(\"The count is: {COUNT}\");
|
tracing::info!(\"The count is: {{COUNT}}\");
|
||||||
});
|
}});
|
||||||
})
|
}})
|
||||||
}
|
}}
|
||||||
```"
|
```"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user