From 3a49ae13c7c53ba9d4b26c452f66ce82288e6e79 Mon Sep 17 00:00:00 2001 From: Thejas Kiran P S <30928792+ThejasKiranPS@users.noreply.github.com> Date: Sun, 30 Oct 2022 09:53:31 +0530 Subject: [PATCH] provide unique key instead of index As providing index as keys is a bad practice, this commit modifies the key value to be `photo.filepath` which will be unique and consistent while adding new photos. [Keys - react docs](https://reactjs.org/docs/lists-and-keys.html#keys) [example why it is not recommended](https://robinpokorny.com/blog/index-as-a-key-is-an-anti-pattern/) --- docs/react/your-first-app/2-taking-photos.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/react/your-first-app/2-taking-photos.md b/docs/react/your-first-app/2-taking-photos.md index 90c527521bd..513d1a19d1f 100644 --- a/docs/react/your-first-app/2-taking-photos.md +++ b/docs/react/your-first-app/2-taking-photos.md @@ -131,7 +131,7 @@ With the photo(s) stored into the main array we can display the images on the sc {photos.map((photo, index) => ( - + ))}