Add key to list of PromptOption components
authorCarl Worth <cworth@cworth.org>
Mon, 29 Jun 2020 15:05:23 +0000 (08:05 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 29 Jun 2020 15:05:23 +0000 (08:05 -0700)
This is the classic thing to overlook in React programming. It's easy
to forget the key until React warns that it's missing.

empathy/empathy.jsx

index 4151cf729edf1de6a53151ad49b947aeb2e504d9..feff7775a99f782188474bab923da9e1580b8327 100644 (file)
@@ -414,7 +414,13 @@ const PromptOptions = React.memo(props => {
         Select any categories below that you'd like to play.
         You can choose as many as you'd like.
       </p>
-    {props.prompts.map(p => <PromptOption prompt={p} player={props.player} />)}
+      {props.prompts.map(
+        prompt => <PromptOption
+                    key={prompt.id}
+                    prompt={prompt}
+                    player={props.player}
+                  />
+      )}
     </div>
   );
 });