I\'m following the React Tutorial and got stuck on how to use React.findDOMNode
.
Here is my code:
export class CommentForm extends React.Com
EDIT: nlaq provided the answer to my question, however I think the following can be useful for readers, so I will leave this answer up.
After reading Forms | React article, I was able to acquire the value by handling the onChange
event:
handleChange(e) {
e.preventDefault();
console.log(e.target.value); // e.target.value gives the value in the input box
}
render() {
return ;
}
I'm still puzzled why the tutorial showed the use of findDOMNode
. Perhaps the tutorial is showing an old way? I'm still new to React, so if there is a more intuitive way please let me know.
For a full example, this SO answer helped me out.