The selected member of a collection is part of the state of that collection. The collection not the unit should then be responsible for selecting. Benefits, Meteor won't need to auto call setState on each Player component now. Instead the leaderboard collection component will try to rerender each Player and React can prune away any changes that aren't needed.
Also changed <Player id= to <Player key= as mentioned in the React docs.
The selected member of a collection is part of the state of that collection. The collection not the unit should then be responsible for selecting. Benefits, Meteor won't need to auto call
setState
on eachPlayer
component now. Instead the leaderboard collection component will try to rerender eachPlayer
and React can prune away any changes that aren't needed.Also changed
<Player id=
to<Player key=
as mentioned in the React docs.