How does Dioxus mut signals work?

⚓ Rust    📅 2025-09-01    👤 surdeus    👁️ 12      

surdeus

Warning

This post was published 93 days ago. The information described in this article may have changed.

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

Read full topic

🏷️ Rust_feed