dioxus/packages/web/examples/children.rs

37 lines
728 B
Rust
Raw Normal View History

2021-06-08 18:00:29 +00:00
//! Basic example that renders a simple VNode to the browser.
use dioxus_core::prelude::*;
use dioxus_web::*;
fn main() {
// Setup logging
wasm_logger::init(wasm_logger::Config::new(log::Level::Debug));
console_error_panic_hook::set_once();
// Run the app
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App));
}
2021-06-26 01:15:33 +00:00
static App: FC<()> = |cx| {
cx.render(rsx! {
2021-06-08 18:00:29 +00:00
Calcier {
h2 {"abc 1"}
h2 {"abc 2"}
h2 {"abc 3"}
h2 {"abc 4"}
h2 {"abc 5"}
}
})
};
2021-06-26 01:15:33 +00:00
static Calcier: FC<()> = |cx| {
cx.render(rsx! {
2021-06-08 18:00:29 +00:00
div {
h1 {
"abc 0"
}
2021-06-26 01:15:33 +00:00
{cx.children()}
2021-06-08 18:00:29 +00:00
}
})
};