Add #[derive(Clone)] in examples (#111)

* Add #[derive(Clone)] in examples

Closes #110

* Add backticks to rust elements

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Another backtics

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
This commit is contained in:
Mingun 2020-06-28 14:10:39 +05:00 committed by Justin Starry
parent 840b0aa4ae
commit 6a07d91b37

View File

@ -42,7 +42,7 @@ html! {
```rust
pub struct Container(Props);
#[derive(Properties)]
#[derive(Properties, Clone)]
pub struct Props {
pub children: Children,
}
@ -63,6 +63,8 @@ impl Component for Container {
```
{% endcode %}
{% hint style="info" %} Types for which you derive `Properties` must also implement `Clone`. This can be done by either using `#[derive(Properties, Clone)]` or manually implementing `Clone` for your type. {% endhint %}
## Nested Children with Props
Nested component properties can be accessed and mutated if the containing component types its children.
@ -86,7 +88,7 @@ html! {
```rust
pub struct List(Props);
#[derive(Properties)]
#[derive(Properties, Clone)]
pub struct Props {
pub children: ChildrenWithProps<ListItem>,
}
@ -107,4 +109,3 @@ impl Component for List {
}
```
{% endcode %}