basic.rs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //! Basic example that renders a simple domtree to the browser.
  2. use dioxus_core::prelude::*;
  3. use dioxus_web::*;
  4. fn main() {
  5. // Setup logging
  6. wasm_logger::init(wasm_logger::Config::new(log::Level::Debug));
  7. console_error_panic_hook::set_once();
  8. // Run the app
  9. wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App));
  10. }
  11. static App: FC<()> = |ctx, _| {
  12. log::info!("Ran component");
  13. use dioxus::builder::*;
  14. todo!()
  15. // ctx.render(|b| {
  16. // div(b)
  17. // .child(text("hello"))
  18. // .listeners([on(b, "click", |_| {
  19. // //
  20. // log::info!("button1 clicked!");
  21. // })])
  22. // .finish()
  23. // })
  24. // ctx.render(html! {
  25. // <div onclick={move |_| log::info!("button1 clicked!")}>
  26. // "Hello"
  27. // // <div class="flex items-center justify-center flex-col">
  28. // // <div class="font-bold text-xl"> "Count is ..." </div>
  29. // // <button onclick={move |_| log::info!("button1 clicked!")}> "increment" </button>
  30. // // <button onclick={move |_| log::info!("button2 clicked!")}> "decrement" </button>
  31. // // </div>
  32. // </div>
  33. // })
  34. };