tictactoe: Improve player-info block for the case of no assigned team
authorCarl Worth <cworth@cworth.org>
Fri, 5 Jun 2020 17:50:04 +0000 (10:50 -0700)
committerCarl Worth <cworth@cworth.org>
Sat, 6 Jun 2020 11:46:51 +0000 (04:46 -0700)
An explicit clause of "not on a team" is more clear than the dangling
"on team: ".

tictactoe/tictactoe.jsx

index a7614bcaf56168424da88827830cfbbea54be6c9..f5951f1ff26a4bb738dd26a13c74f13feed08ccf 100644 (file)
@@ -90,7 +90,8 @@ function PlayerInfo(props) {
   return (
     <div className="player-info">
       <h2>Player</h2>
-      {props.name}, ID: {props.id}, on team: {props.team}
+      {props.name}, ID: {props.id},
+      {props.team ? ` on team ${props.team}` : " not on a team"}
     </div>
   );
 }