1
0

basic.rs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //! basic example that renders a simple domtree to the page :)
  2. //!
  3. //!
  4. //!
  5. use dioxus_core::prelude::bumpalo::Bump;
  6. use dioxus_core::prelude::*;
  7. use dioxus_web::*;
  8. fn main() {
  9. wasm_logger::init(wasm_logger::Config::new(log::Level::Debug));
  10. console_error_panic_hook::set_once();
  11. WebsysRenderer::simple_render(html! {
  12. <div>
  13. <div class="flex items-center justify-center flex-col">
  14. <div class="font-bold text-xl"> "Count is {}" </div>
  15. <button onclick={move |_| log::info!("button1 clicked!")}> "increment" </button>
  16. <button onclick={move |_| log::info!("button2 clicked!")}> "decrement" </button>
  17. </div>
  18. </div>
  19. });
  20. // WebsysRenderer::simple_render(html! {
  21. // <div>
  22. // <div class="flex items-center justify-center flex-col">
  23. // <div class="flex items-center justify-center">
  24. // <div class="flex flex-col bg-white rounded p-4 w-full max-w-xs">
  25. // // Title
  26. // <div class="font-bold text-xl">
  27. // "Jon's awesome site!!11"
  28. // </div>
  29. // // Subtext / description
  30. // <div class="text-sm text-gray-500">
  31. // "He worked so hard on it :)"
  32. // </div>
  33. // <div class="flex flex-row items-center justify-center mt-6">
  34. // // Main number
  35. // <div class="font-medium text-6xl">
  36. // "1337"
  37. // </div>
  38. // </div>
  39. // // Try another
  40. // <div class="flex flex-row justify-between mt-6">
  41. // // <a href=format!("http://localhost:8080/fib/{}", other_fib_to_try) class="underline">
  42. // "Legit made my own React"
  43. // // </a>
  44. // </div>
  45. // </div>
  46. // </div>
  47. // </div>
  48. // </div>
  49. // });
  50. }