dioxus/examples/multiwindow.rs
Jonathan Kelley dd4547d753
Feat: add global context functions
Add functions like window() and router() to
allow dynamically grabbing global contexts
without have to use the hook variants.

Deprecates the existing hook variants to
discourage folks from adding more noise
to their codebases.
2023-10-23 16:26:10 -04:00

25 lines
512 B
Rust

use dioxus::prelude::*;
fn main() {
dioxus_desktop::launch(app);
}
fn app(cx: Scope) -> Element {
cx.render(rsx! {
div {
button {
onclick: move |_| {
let dom = VirtualDom::new(popup);
dioxus_desktop::window().new_window(dom, Default::default());
},
"New Window"
}
}
})
}
fn popup(cx: Scope) -> Element {
cx.render(rsx! {
div { "This is a popup!" }
})
}