Skip to content

Instantly share code, notes, and snippets.

@davidedelpapa
Created July 25, 2020 13:10
Show Gist options
  • Save davidedelpapa/bc524a7a3c7d8e9d3806120a1e41780b to your computer and use it in GitHub Desktop.
Save davidedelpapa/bc524a7a3c7d8e9d3806120a1e41780b to your computer and use it in GitHub Desktop.
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