-
Hey :) next question, as more people might struggle in the future: somehow it seems like signals support only primitive types like Strings or numeric values. I just tried to fetch a enum like the following in a signal: pub enum Notification {
Success(String),
Warning(String),
Error(String),
}
...
let (send_alert_message, set_send_alert_message) = create_signal::<Option<Notification>>(cx, None); When I try to use this signal like here: {move || {
if send_alert_message().is_some() {
view! { cx, <div>"Sent message"</div>}
} else {
view! { cx, <div>"Not yet"</div>}
}
}} I get the following compiler error:
If I use a Thanks :) |
Beta Was this translation helpful? Give feedback.
Answered by
floric
Jan 22, 2023
Replies: 1 comment
-
I also found the solution here :) We need to implement #[derive(Clone)]
pub enum Notification {
Success(String),
Warning(String),
Error(String),
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
floric
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I also found the solution here :)
We need to implement
Clone
by deriving or implementing it. For me, deriving was enough: