smithy
smithy copied to clipboard
Nested components
Thank you for this crate. It is very useful in our use cases.
Could you please add example of nested components? For example:
<MyButton>
Some text
</MyButton>
I tried something like this:
pub fn render_my_button<'a, 'b>(children: SmithyComponent<'b>) -> SmithyComponent<'a> {
smd!(
<button>{ children }</button>
)
}
// ....
smd!{
<div>
{ render_my_button(smd!(<div>Increment</div>)) }
{ render_my_button(smd!(<div>Decrement</div>)) }
</div>
}
I tried with smd_borrowed, but didn't help. I get this error:
[E0277] the trait bound `smithy::types::Node: smithy::types::Component` is not satisfied.
[Note] the trait `smithy::types::Component` is not implemented for `smithy::types::Node`
Probably I should dig deeper in the code, but asking it is easier.