empathy: Add a comman between player names
authorCarl Worth <cworth@cworth.org>
Thu, 11 Jun 2020 23:01:06 +0000 (16:01 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 11 Jun 2020 23:01:06 +0000 (16:01 -0700)
And also simplify the code quite a bit, (using a simple join()
function instead of a map with multiple span and literal {" "}
elements.

empathy/empathy.jsx

index 8c7b9170d8c0b0dbb29ae05f6765d36c1c17ee52..fcfea4d4c0f72edbb3316d54ecdcfc78e79c2dba 100644 (file)
@@ -656,12 +656,7 @@ class Game extends React.PureComponent {
             {state.scores.words.map(word => {
               return (
                 <li key={word.word}>
-                  {word.word}:
-                  {word.players.map(p => {
-                    return (
-                      <span key={p}>{p}{" "}</span>
-                    );
-                  })}
+                  {`${word.word}: ${word.players.join(', ')}`}
                 </li>
               );
             })}