}
function PlayerInfo(props) {
- if (! props.id)
+ if (! props.player.id)
return null;
return (
<div className="player-info">
<h2>Player</h2>
- {props.name}, ID: {props.id},
- {props.team ? ` on team ${props.team}` : " not on a team"}
+ {props.player.name}
+ {props.player.team ? ` (${props.player.team})` : ""}
</div>
);
}
/>,
<PlayerInfo
key="player-info"
- id={state.player_info.id}
- name={state.player_info.name}
- team={state.player_info.team}
+ player={state.player_info}
/>,
<div key="game" className="game">
<button className="inline"
onClick={() => this.join_team('X')}>Join Team X</button>
-
+ {" "}
<button className="inline"
onClick={() => this.join_team('O')}>Join Team O</button>
<div>{status}</div>