Skip to content

Commit

Permalink
Add #[derive(Clone)] in examples (#111)
Browse files Browse the repository at this point in the history
* Add #[derive(Clone)] in examples

Closes #110

* Add backticks to rust elements

Co-authored-by: Teymour Aldridge <[email protected]>

* Another backtics

Co-authored-by: Teymour Aldridge <[email protected]>
  • Loading branch information
2 people authored and jstarry committed Aug 16, 2020
1 parent f790334 commit e1a7c21
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/concepts/html/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ html! {
```rust
pub struct Container(Props);

#[derive(Properties)]
#[derive(Properties, Clone)]
pub struct Props {
pub children: Children,
}
Expand All @@ -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.
Expand All @@ -86,7 +88,7 @@ html! {
```rust
pub struct List(Props);

#[derive(Properties)]
#[derive(Properties, Clone)]
pub struct Props {
pub children: ChildrenWithProps<ListItem>,
}
Expand All @@ -107,4 +109,3 @@ impl Component for List {
}
```
{% endcode %}

0 comments on commit e1a7c21

Please sign in to comment.