readme.rs 455 B

1234567891011121314151617181920
  1. //! Example: README.md showcase
  2. //!
  3. //! The example from the README.md.
  4. use dioxus::prelude::*;
  5. fn main() {
  6. dioxus::desktop::launch(App, |c| c);
  7. }
  8. static App: FC<()> = |cx| {
  9. let mut count = use_state(cx, || 0);
  10. cx.render(rsx! {
  11. div {
  12. h1 { "High-Five counter: {count}" }
  13. button { onclick: move |_| count += 1, "Up high!" }
  14. button { onclick: move |_| count -= 1, "Down low!" }
  15. }
  16. })
  17. };