###ES6 arrow function
Nice work using functional programming (i.e. .map()
) and the arrow function. One improvement here is that there isn't much of a need for a block and return
statement. So the render
method can be reduced like below:
render() {
return <ul> {
this.state.comments.map((comment) => <li>{comment.body}—{comment.author}</li>)
}</ul>;
}
###jQuery - just for AJAX requests? I see that jQuery is used for the AJAX code. If that is all jQuery is used for, consider using a different technique like the fetch API (read this article for more info).
componentDidMount() {
fetch(JSON_URL )
.then(function(data) {
return data.json();
})
.then(function(data) {
this.setState({comments: data.comments});
}.bind(this));
See this plunker for a demonstration.