Im working on the Camper Leaderboard, and I basically got all the data working right (the link: http://codepen.io/roman_fedoruk/pen/dNPdaP?editors=0011) but the code that I implemented to switch between all time points and 30-day points doesn’t work.
Here is the code:
getInitialState : function() {
return { showAllTime : false };
},
onClick : function() {
this.setState({ ShowAllTime : true} );
}
And here is part of the render function:
if(this.state.showAllTime){
return(
<div>Leaderboard
<table>
<th>#</th>
<th>Username</th>
<th>Recent Points</th>
<th>All Time Points</th>
{listAllTime}
</table></div>
);
}else{
return(
<div>Leaderboard
<table>
<th>#</th>
<th>Username</th>
<th>Recent Points</th>
<th><a onClick={this.onClick} href="#">All Time Points</a></th>
{listRecent}
</table></div>
);
}
}