Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var Form = React.createClass({
focusOnField: function(){
React.findDOMNode(this.refs.textField).focus();
},
render: function(){
return (
<div>
<input
type="text"
ref="textField" />
<input
type="submit"
value="Focus on the input!"
onClick={this.focusOnField} />
</div>
);
}
});
var App = React.createClass({
render: function(){
return (
<div>
<h1> Welcome to the focus app!</h1>
<Form />
</div>
);
}
});
React.render(<App />, document.getElementById("app"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment