Replies: 2 comments 1 reply
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Yeah so we definitely won't make the breaking change of removing the current syntax. We can add something. I had trouble figuring out how to read your example at first, but I think our macro parser could support something like <p class="text-center mb-2 mt-2 font-bold color-red-700 dark:color-white"
class:hidden=move || count() <= 2
class=(["color-blue", "mt-4"], move || count() > 2)
> with the new syntax being that last I'm pretty cautious about adding new syntax in the view macro itself to do things that can be done another way. For example, this particular case is pretty easily written using normal Rust conditional logic in a derived signal as let class = move || {
format!(
"text-center mb-2 mt-2 font-bold color-red-700 dark:color-white {}",
if count() > 2 {
"color-blue mt-4"
} else {
"hidden"
}
)
};
view! { cx,
<p class=class></p>
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Change the current syntax:
To something like (psuedo-code):
Beta Was this translation helpful? Give feedback.
All reactions