Skip to content

Commit

Permalink
use html! in transformer demonstration
Browse files Browse the repository at this point in the history
  • Loading branch information
siku2 committed Oct 20, 2020
1 parent effced3 commit 620e503
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/concepts/html/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,15 @@ struct Props {
text: String,
}

struct Model;
impl Component for Model {
type Properties = Props;

// ...
}

// transformers allow you to write this:
yew::props!(Props { unique_id: 5, text: "literals are fun" });
html! { <Model unique_id=5 text="literals are fun" /> };
// instead of:
yew::props!(Props { unique_id: Some(5), text: "literals are fun".to_owned() });
html! { <Model unique_id=Some(5) text="literals are fun".to_owned() /> };
```

0 comments on commit 620e503

Please sign in to comment.