Permalink
Browse files

Step 4.2: Add handleSubmit method to App component

  • Loading branch information...
stubailo committed Jul 13, 2015
1 parent 8a0525c commit 1b87eff8bd37fc375f506c32b9c4d765f15b301f
Showing with 15 additions and 0 deletions.
  1. +15 −0 App.jsx
15 App.jsx
@@ -18,6 +18,21 @@ App = React.createClass({
});
},

handleSubmit(event) {
event.preventDefault();

// Find the text field via the React ref
var text = React.findDOMNode(this.refs.textInput).value.trim();

This comment has been minimized.

@SachaG

SachaG Nov 14, 2015

Why are we doing React.findDOMNode(this.refs.textInput).value instead of just this.refs.textInput.value here?


Tasks.insert({
text: text,
createdAt: new Date() // current time
});

// Clear form
React.findDOMNode(this.refs.textInput).value = "";
},

render() {
return (
<div className="container">

0 comments on commit 1b87eff

Please sign in to comment.