Skip to content

Commit 8a9323a

Browse files
committed
Update app.js
Adding event.preventDefault(); to the handleSubmit method prevents the browser from submitting the form via standard mechanisms in turn engaging and demonstrating React mechanisms.
1 parent df2e999 commit 8a9323a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

examples/commentsBox/js/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var CommentList = React.createClass({
2929

3030
var CommentForm = React.createClass({
3131
handleSubmit: function() {
32+
event.preventDefault();
3233
var author = this.refs.author.getDOMNode().value.trim();
3334
var text = this.refs.text.getDOMNode().value.trim();
3435
this.props.onCommentSubmit({author: author, text: text});

0 commit comments

Comments
 (0)