Skip to content

Instantly share code, notes, and snippets.

@hpstuff
Last active April 17, 2018 07:51
Show Gist options
  • Save hpstuff/3335d61e828c483d879bb720453b2f5c to your computer and use it in GitHub Desktop.
Save hpstuff/3335d61e828c483d879bb720453b2f5c to your computer and use it in GitHub Desktop.
<CompareWrapper>
{this.renderPlayers}
</CompareWrapper>
renderPlayers(playerIDs, addPlayer) {
return playerIDs.map((playerID) =>
<PlayerWrapper id={playerID}>
{(player) => this.renderPlayer(player, addPlayer)}
</PlayerWrapper>
)
}
renderPlayer({name, picture}, addPlayer) {
return (
<Player name={name} picture={picture}>
<Button onPress={() => addPlayer(otherPlayerId)}></Button>
<Table>{/*(...)*/}</Table>
</Player>
);
}
<CompareWrapper>
{(playerIDs, addPlayer) =>
playerIDs.map((playerID) =>
<PlayerWrapper id={playerID}>
{({name, picture}) =>
<Player name={name} picture={picture}>
<Button onPress={() => addPlayer(otherPlayerId)}></Button>
<Table>{/*(...)*/}</Table>
</Player>}
</PlayerWrapper>
)
}
</CompareWrapper>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment