}
set_other_player_info(info) {
- const player_object = {...info, active: true};
const other_players_copy = [...this.state.other_players];
const idx = other_players_copy.findIndex(o => o.id === info.id);
if (idx >= 0) {
- other_players_copy[idx] = player_object;
+ other_players_copy[idx] = info;
} else {
- other_players_copy.push(player_object);
+ other_players_copy.push(info);
}
this.setState({
other_players: other_players_copy