1
0

main.rs 769 B

1234567891011121314151617181920212223242526272829
  1. // This test is used by playwright configured in the root of the repo
  2. // Tests:
  3. // - Static Generation
  4. // - Simple Suspense
  5. // - Hydration
  6. #![allow(non_snake_case)]
  7. use dioxus::prelude::*;
  8. fn main() {
  9. LaunchBuilder::static_generation().launch(app);
  10. }
  11. fn app() -> Element {
  12. let mut count = use_signal(|| 12345);
  13. let server_data = use_server_future(get_server_data)?;
  14. rsx! {
  15. h1 { "hello axum! {count}" }
  16. button { class: "increment-button", onclick: move |_| count += 1, "Increment" }
  17. "Server said: {server_data:?}"
  18. }
  19. }
  20. #[server(GetServerData)]
  21. async fn get_server_data() -> Result<String, ServerFnError> {
  22. tokio::time::sleep(std::time::Duration::from_millis(100)).await;
  23. Ok("Hello from the server!".to_string())
  24. }