mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 14:44:12 +00:00
Merge pull request #396 from jmoore34/patch-1
This commit is contained in:
commit
fff341a6a9
1 changed files with 1 additions and 1 deletions
|
@ -102,7 +102,7 @@ For keen Rustaceans: notice how we don't actually call `collect` on the name lis
|
|||
|
||||
## Keeping list items in order with `key`
|
||||
|
||||
The examples above demonstrate the power of iterators in `rsx!` but all share the same issue: if your array items move (e.g. due to sorting), get inserted, or get deleted, Dioxus has no way of knowing what happened. This can cause Elements to be unnecessarily removed, changed and rebuilt when all that was needed was to change their position – this is inneficient.
|
||||
The examples above demonstrate the power of iterators in `rsx!` but all share the same issue: if your array items move (e.g. due to sorting), get inserted, or get deleted, Dioxus has no way of knowing what happened. This can cause Elements to be unnecessarily removed, changed and rebuilt when all that was needed was to change their position – this is inefficient.
|
||||
|
||||
To solve this problem, each item in the list must be **uniquely identifiable**. You can achieve this by giving it a unique, fixed "key". In Dioxus, a key is a string that identifies an item among others in the list.
|
||||
|
||||
|
|
Loading…
Reference in a new issue