-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support tags with dynamic/variable children #230
Comments
Maybe we could pass |
Passing closure would allow to transform for example |
Example from above redone: mox! {
<div>
<div>{% "hello world from moxie! ({})", &count }</div>
<button type="button" onclick={move |_| set_count.update(|c| Some(c + 1))}>
"increment"
</button>
{ ["first", "second", "third"].iter().map(|t| mox! { <div>{ *t }</div> }) }
</div>
} |
I hadn't thought of supporting iterators directly, I like that idea a lot. |
Not sure if that should replace the ability to write your own loop, but maybe it's enough? |
If you would like to use loops, then use generators. |
In the dom-hacking example, we ensure we can add children in a loop (which also works for a conditional):
moxie/dom/examples/hacking/src/lib.rs
Lines 26 to 39 in dfca4be
It would be nice to be able to write the whole example as a single mox invocation, maybe something like:
The text was updated successfully, but these errors were encountered: