autoFocus={true}
componentDidMount() {
this.refs.searchInput.value = this.refs.searchInput.value
},
<input type="text"
ref="searchInput"
autoFocus={true}
value={this.props.searchTerm}
> </input>
The ref Callback Attribute
The ref attribute can be a callback function instead of a name. This callback will be executed immediately after the component is mounted. The referenced component will be passed in as a parameter, and the callback function may use the component immediately, or save the reference for future use (or both).
It's as simple as assigning a ref attribute to anything returned from render such as:<input ref={ function(component){ React.findDOMNode(component).focus();} } />
React.findDOMNode(this.refs.myTextInput).focus();