REACT
The Value Proposition
Facebook, Instagram, WhatsApp, Yahoo, Netflix, Imgur, Reddit, Wired, BBC, New York Times, Flipboard, Atlassian, Asana, Khan Academy, Instructure, AirBnB, Redfin
var CommentBox = React.createClass({
loadCommentsFromServer: function() {
$.ajax({
url: this.props.url,
dataType: 'json',
success: function(data) {
this.setState({data: data});
}.bind(this),
error: function(xhr, status, err) {
console.error(this.props.url, status, err.toString());
}.bind(this)
});
},
getInitialState: function() {
return {data: []};
},
componentDidMount: function() {
this.loadCommentsFromServer();
setInterval(this.loadCommentsFromServer, this.props.pollInterval);
},
render: function() {
return (
<div className="commentBox">
<h1>Comments</h1>
<CommentList data={this.state.data} />
<CommentForm />
</div>
);
}
});
React.render(
<CommentBox url="comments.json" pollInterval={2000} />,
document.getElementById('content')
);
ACTION
DISPATCHER
STORE
VIEW
Erik Bryn
eventually be written in JavaScript.
Jeff Atwood
Edsger Dijkstra
Rich Hickey
Edsger Dijkstra