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.
This commit is contained in:
Jay Landro
2016-04-08 16:09:50 -05:00
parent df2e9998ef
commit 8a9323a5d3

View File

@@ -29,6 +29,7 @@ var CommentList = React.createClass({
var CommentForm = React.createClass({
handleSubmit: function() {
event.preventDefault();
var author = this.refs.author.getDOMNode().value.trim();
var text = this.refs.text.getDOMNode().value.trim();
this.props.onCommentSubmit({author: author, text: text});