Closed tqwewe closed 2 years ago
What's the advantage of this over using apply
?
html!("div", {
.apply(|this| {
this.event(...)
})
})
html!("div", {
.apply(|this| match format_args("foo").as_str() {
Some(s) => this.text(s),
None => this.text(&format!("foo")),
})
})
I actually wasn't really aware of apply. I think apply is actually exactly what I needed
Adds support for more dynamic methods in the
apply_methods!
macro.This is done with the syntax of a closure.
This is needed for more advanced cases such as cases where you need to return data temporarily to a method. For example, this doesn't work:
With this PR, you can now do this instead: