Skip to content

Commit

Permalink
Add keys explanation when it is first introduced
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan Zhang committed Nov 3, 2022
1 parent daac993 commit ef7d8fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions website/docs/tutorial/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ let videos = videos.iter().map(|video| html! {
}).collect::<Html>();
```

:::tip
Keys on list items helps Yew keep track of which items have changed in the list, resulting in faster re-renders. [It is always recommended to use keys in lists](/concepts/html/lists#keyed-lists).
:::

And finally we need to replace the hardcoded list of videos with the `Html` we created from data:

```rust ,ignore {6-10}
Expand Down

0 comments on commit ef7d8fc

Please sign in to comment.