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

Commit 1a7d5b8

Browse files
jstarrygitbook-bot
authored andcommitted
GitBook: [master] 3 pages modified
1 parent befa17e commit 1a7d5b8

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

‎src/concepts/components/README.md‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,21 @@ impl Component for MyComponent {
130130

131131
### Change
132132

133-
Components may be re-rendered by their parents. When this happens, they could receive new properties and choose to re-render. This design facilitates parent to child component communication through changed properties. You don't have to implement `change()` but you probably want to if you want to update a component via props after it has been created.
133+
Components may be re-rendered by their parents. When this happens, they could receive new properties and choose to re-render. This design facilitates parent to child component communication through changed properties.
134134

135-
A naive implementation would look like:
135+
A typical implementation would look like:
136136

137137
```rust
138138
impl Component for MyComponent {
139139
// ...
140140

141141
fn change(&mut self, props: Self::Properties) -> ShouldRender {
142-
self.props = props;
143-
true // This will always re-render when new props are provided.
142+
if self.props != props {
143+
self.props = props;
144+
true
145+
} else {
146+
false
147+
}
144148
}
145149
}
146150
```

‎src/concepts/router.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The Router component communicates with `RouteAgent` and will automatically resol
3434

3535
First, you want to create a type that represents all the states of your application. Do note that while this typically is an enum, structs are supported as well, and that you can nest other items that implement `Switch` inside.
3636

37-
Then you should derive `Switch` for your type. For enums, every variant must be annotated with `#[to = "/some/route"]`, or if you use a struct instead, that must appear outside the struct declaration.
37+
Then you should derive `Switch` for your type. For enums, every variant must be annotated with `#[to = "/some/route"]`, or if you use a struct instead, that must appear outside the struct declaration.
3838

3939
```rust
4040
#[derive(Switch)]

‎src/getting-started/starter-templates.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ wasm-bindgen = "0.2"
3030
{% endcode %}
3131

3232
## Other templates
33+
3334
* [Parcel Template](https://github.com/spielrs/yew-parcel-template) - Created by a community member and uses [Parcel](https://parceljs.org/)
35+

0 commit comments

Comments
 (0)