mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-27 14:40:44 +00:00
dd4547d753
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.
25 lines
512 B
Rust
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!" }
|
|
})
|
|
}
|