Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: How does Dioxus mut signals work?
Dioxus demonstrations explicitly declare signals/states as mut
let mut x = use_signal(|| 0.0f64);
The problem I see with this is that then taking this x
mutably in lambdas keepsx
moved until the lambda is dropped, which means the component's rsx!
macro shouldn't be able to use the signal at all. Somehow, Dioxus just works with it.
To me it should be:
let x = use_signal(|| 0.0f64);
And don't allow std::ops
like AddAssign
and use interior mutability.
1 post - 1 participant
🏷️ Rust_feed