4
Użyć state lub refs w komponentach formularza React.js?
Zaczynam od React.js i chcę zrobić prosty formularz, ale w dokumentacji znalazłem na to dwa sposoby. Pierwszy używa Refs : var CommentForm = React.createClass({ handleSubmit: function(e) { e.preventDefault(); var author = React.findDOMNode(this.refs.author).value.trim(); var text = React.findDOMNode(this.refs.text).value.trim(); if (!text || !author) { return; } // TODO: send request to the server …
116
reactjs