I made a minimal example of code that "should" be working from my understanding, but isn't.
Here it is:
use dioxus::prelude::*;
fn main() {
#[cfg(feature = "ssr")] {
use dioxus_fullstack::prelude::*;
tokio::runtime::Runtime::new()
.unwrap()
.block_on(async move {
let app = axum::routing::Router::new()
.serve_dioxus_application(
"",
ServeConfigBuilder::new(App, ())
);
let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 3000));
println!("Listening on: {addr}");
axum::Server::bind(&addr)
.serve(app.into_make_service())
.await
.unwrap();
})
}
}
#[component]
pub fn App(cx: Scope) -> Element {
let count = use_state(cx, || vec![0, 1, 2, 3, 4]);
render! {
button {
onclick: move |_| {
count.make_mut().remove(0);
},
"ok {count[0]}"
}
}
}
When I launch this code, everything compiles but when I click on the button, it stays at "ok 0".
Why ?
Command used:
$ dx build --features web --release
$ cargo run --features ssr --release