simple.rs 481 B

1234567891011121314151617181920212223242526272829
  1. #![allow(non_snake_case)]
  2. use dioxus::prelude::*;
  3. use dioxus_router::prelude::*;
  4. fn main() {
  5. dioxus_desktop::launch(App);
  6. }
  7. fn App(cx: Scope) -> Element {
  8. use_router(
  9. &cx,
  10. &|| RouterConfiguration {
  11. ..Default::default()
  12. },
  13. &|| Segment::content(comp(RootIndex)),
  14. );
  15. render! {
  16. h1 { "hi" }
  17. Outlet { }
  18. }
  19. }
  20. fn RootIndex(cx: Scope) -> Element {
  21. render! {
  22. h1 { "Simple Example App" }
  23. }
  24. }