Closed tokcum closed 2 years ago
In general you shouldn't be storing Dom
inside of a Mutable
. That's because child_signal
and children_signal_vec
require owned values, and signal_ref
gives you a reference, not an owned value.
It's also not good design, because you're conflating your app's data with your app's rendering. Instead you should be storing your app's data inside of the Mutable
, and use map
to convert it into a Dom
.
It would really help if you could explain what you're trying to do. Your code doesn't really tell me very much.
Thanks Pauan, I just wanted to know how to use signal_ref. Thanks to your guidance, I understood the approach. I never really wanted to have a Mutable
Tata: it works! Thanks again. 🙂
Hi,
I'm trying to use child_signal() but struggle to create a Signal<Item = Option> as required by the trait bound. I assume, I've to use signal_ref() as Dom does neither implement Copy nor Clone, so signal() and signal_cloned do not work. Correct?
This is what I have put together so far. I guess, I'm missing something obvious or misunderstand the approach completely. A example code showing how this is meant to be used would be great.
This is the compiler error:
Any help appreciated. Thanks.