React and Codepen for Camper Leaderboard

I keep getting “unexpected token: <”. Could someone explain why?

You left side is a function call. You can’t assign to a function call. It makes no sense.

this.toggleSort() = this.toggleSort.bind(this);

It should be like this:

this.toggleSort = this.toggleSort.bind(this);

Okay, thanks. I changed that, but I’m still getting the error.

You have to return only one element in render method. SO you need to wrap all in div or what ever. React 16 allows to return in render multiple elements but it is currently in beta. For example this will work fine

	    return (
				<button onClick={this.toggleSort}>
					{" "}Sort By {this.state == "alltime" ? "Last 30 Days" : "All Time"}
					{" "}
				<ul> {listItems}
				{" "}</ul>

Oh! It works now. Thank you.