dioxus/packages/web/examples/hello.rs

31 lines
810 B
Rust
Raw Normal View History

use dioxus_core as dioxus;
2021-02-12 21:11:33 +00:00
use dioxus_core::prelude::*;
use dioxus_web::WebsysRenderer;
fn main() {
2021-05-31 22:55:56 +00:00
wasm_logger::init(wasm_logger::Config::new(log::Level::Debug));
console_error_panic_hook::set_once();
log::info!("hello world");
2021-02-24 08:51:26 +00:00
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example));
2021-02-12 21:11:33 +00:00
}
static Example: FC<()> = |ctx| {
2021-06-23 05:44:48 +00:00
let nodes = (0..15).map(|f| rsx! (li { key: "{f}", "{f}"}));
2021-05-31 22:55:56 +00:00
ctx.render(rsx! {
div {
span {
class: "px-2 py-1 flex w-36 mt-4 items-center text-xs rounded-md font-semibold text-yellow-500 bg-yellow-100"
"DUE DATE : 189 JUN"
}
p {
"these"
"are"
"text"
"nodes"
2021-05-31 22:55:56 +00:00
}
{nodes}
2021-05-31 22:55:56 +00:00
}
2021-02-12 21:11:33 +00:00
})
};