From ae716058c2f6244f1c84d7d585f321542328bd8f Mon Sep 17 00:00:00 2001 From: ajcumine Date: Tue, 10 Oct 2017 19:28:32 +0100 Subject: [PATCH] revert update to usage of index as key wording --- content/docs/reconciliation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/reconciliation.md b/content/docs/reconciliation.md index eaf085f5..e209ff2e 100644 --- a/content/docs/reconciliation.md +++ b/content/docs/reconciliation.md @@ -138,7 +138,7 @@ In practice, finding a key is usually not hard. The element you are going to dis When that's not the case, you can add a new ID property to your model or hash some parts of the content to generate a key. The key only has to be unique among its siblings, not globally unique. -As a last resort, you can pass item's index in the array as a key. This can work well if the items are never reordered. However, there will be a performance impact with reordering as React will naively update components. +As a last resort, you can pass item's index in the array as a key. This can work well if the items are never reordered, but reorders will be slow. There can also be issues with the state of a component in a list if indexes are used as keys. The state of an item in a list (or any deep state inside of it) will stay attached to the original position of the item, even if the item has “moved” in the data source. This is particularly noticeable with inputs retaining their values in the original positions even when their parent components reorder or are prepended to.