Skip to content
This repository was archived by the owner on Jul 19, 2020. It is now read-only.

Commit a30f56a

Browse files
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>
1 parent 044ed79 commit a30f56a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎src/concepts/html/components.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ html! {
4242
```rust
4343
pub struct Container(Props);
4444

45-
#[derive(Properties)]
45+
#[derive(Properties, Clone)]
4646
pub struct Props {
4747
pub children: Children,
4848
}
@@ -63,6 +63,8 @@ impl Component for Container {
6363
```
6464
{% endcode %}
6565

66+
{% 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 %}
67+
6668
## Nested Children with Props
6769

6870
Nested component properties can be accessed and mutated if the containing component types its children.
@@ -86,7 +88,7 @@ html! {
8688
```rust
8789
pub struct List(Props);
8890

89-
#[derive(Properties)]
91+
#[derive(Properties, Clone)]
9092
pub struct Props {
9193
pub children: ChildrenWithProps<ListItem>,
9294
}
@@ -107,4 +109,3 @@ impl Component for List {
107109
}
108110
```
109111
{% endcode %}
110-

0 commit comments

Comments
 (0)