-
-
Save davidedelpapa/bc524a7a3c7d8e9d3806120a1e41780b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn view(&self) -> Html { | |
let render_item = |item| { | |
html! { | |
<> | |
<tr><td>{ item }</td></tr> | |
</> | |
} | |
}; | |
html! { | |
<div class="main"> | |
<div class="card"> | |
<header> | |
{"Items: "} | |
</header> | |
<div class="card-body"> | |
<table class="primary"> | |
{ for self.items.iter().map(render_item) } | |
</table> | |
</div> | |
<footer> | |
<button onclick=self.link.callback(|_| Msg::AddOne)>{ "Add 1" }</button> {" "} | |
<button onclick=self.link.callback(|_| Msg::RemoveOne)>{ "Remove 1" }</button> | |
</footer> | |
</div> | |
</div> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment