Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed React.autoBind since it's now the default. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions scripts/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ var Comment = React.createClass({
});

var CommentBox = React.createClass({
loadCommentsFromServer: React.autoBind(function() {
loadCommentsFromServer: function() {
$.ajax({
url: this.props.url,
success: function(data) {
this.setState({data: data});
}.bind(this)
});
}),
handleCommentSubmit: React.autoBind(function(comment) {
},
handleCommentSubmit: function(comment) {
var comments = this.state.data;
comments.push(comment);
this.setState({data: comments});
Expand All @@ -35,7 +35,7 @@ var CommentBox = React.createClass({
this.setState({data: data});
}.bind(this)
});
}),
},
getInitialState: function() {
return {data: []};
},
Expand Down Expand Up @@ -64,7 +64,7 @@ var CommentList = React.createClass({
});

var CommentForm = React.createClass({
handleSubmit: React.autoBind(function() {
handleSubmit: function() {
var author = this.refs.author.getDOMNode().value.trim();
var text = this.refs.text.getDOMNode().value.trim();
if (text.length === 0 || author.length === 0) {
Expand All @@ -74,7 +74,7 @@ var CommentForm = React.createClass({
this.refs.author.getDOMNode().value = '';
this.refs.text.getDOMNode().value = '';
return false;
}),
},
render: function() {
return (
<form className="commentForm" onSubmit={this.handleSubmit}>
Expand Down