From 4adc854d6daa21fa90d44b586b90147b07de5d9a Mon Sep 17 00:00:00 2001 From: Matthew Holman Date: Fri, 24 Nov 2017 22:39:19 -0600 Subject: [PATCH 1/3] Added link explaining danger of using index as key --- content/docs/lists-and-keys.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/lists-and-keys.md b/content/docs/lists-and-keys.md index 4c3f3cf6..1ad265ee 100644 --- a/content/docs/lists-and-keys.md +++ b/content/docs/lists-and-keys.md @@ -130,7 +130,7 @@ const todoItems = todos.map((todo, index) => ); ``` -We don't recommend using indexes for keys if the order of items may change. This can negatively impact performance and may cause issues with component state. If you choose not to assign a key to your list items then React will use indexes as keys. You may read an [in-depth explanation about why keys are necessary](/docs/reconciliation.html#recursing-on-children) if you're interested in more information. +We don't recommend using indexes for keys if the order of items may change. This can negatively impact performance and may cause issues with component state. You may read Robin Pokorny's article for an [in-depth explanation on the negative impacts of using an index as a key](https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318). If you choose not to assign a key to your list items then React will use indexes as keys. You may read an [in-depth explanation about why keys are necessary](/docs/reconciliation.html#recursing-on-children) if you're interested in more information. ### Extracting Components with Keys From 97d494995424cb51f4c3d9827f8a49be9b0a354b Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 29 Nov 2017 13:59:13 -0800 Subject: [PATCH 2/3] Wordsmithing --- content/docs/lists-and-keys.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/lists-and-keys.md b/content/docs/lists-and-keys.md index 1ad265ee..f9929921 100644 --- a/content/docs/lists-and-keys.md +++ b/content/docs/lists-and-keys.md @@ -130,7 +130,7 @@ const todoItems = todos.map((todo, index) => ); ``` -We don't recommend using indexes for keys if the order of items may change. This can negatively impact performance and may cause issues with component state. You may read Robin Pokorny's article for an [in-depth explanation on the negative impacts of using an index as a key](https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318). If you choose not to assign a key to your list items then React will use indexes as keys. You may read an [in-depth explanation about why keys are necessary](/docs/reconciliation.html#recursing-on-children) if you're interested in more information. +We don't recommend using indexes for keys if the order of items may change. This can negatively impact performance and may cause issues with component state. (Check out Robin Pokorny's article for an [in-depth explanation on the negative impacts of using an index as a key](https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318).) If you choose not to assign an explicit key to list items then React will default to using indexes as keys. You may read an [in-depth explanation about why keys are necessary](/docs/reconciliation.html#recursing-on-children) if you're interested in more information. ### Extracting Components with Keys From 157501a48cdf9c4852eff89ae1fb408a2b562ab1 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 29 Nov 2017 14:05:05 -0800 Subject: [PATCH 3/3] Split last sentence into its own paragraph --- content/docs/lists-and-keys.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/docs/lists-and-keys.md b/content/docs/lists-and-keys.md index f9929921..a9c444a9 100644 --- a/content/docs/lists-and-keys.md +++ b/content/docs/lists-and-keys.md @@ -130,7 +130,9 @@ const todoItems = todos.map((todo, index) => ); ``` -We don't recommend using indexes for keys if the order of items may change. This can negatively impact performance and may cause issues with component state. (Check out Robin Pokorny's article for an [in-depth explanation on the negative impacts of using an index as a key](https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318).) If you choose not to assign an explicit key to list items then React will default to using indexes as keys. You may read an [in-depth explanation about why keys are necessary](/docs/reconciliation.html#recursing-on-children) if you're interested in more information. +We don't recommend using indexes for keys if the order of items may change. This can negatively impact performance and may cause issues with component state. Check out Robin Pokorny's article for an [in-depth explanation on the negative impacts of using an index as a key](https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318). If you choose not to assign an explicit key to list items then React will default to using indexes as keys. + +Here is an [in-depth explanation about why keys are necessary](/docs/reconciliation.html#recursing-on-children) if you're interested in learning more. ### Extracting Components with Keys