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
None of the above solutions quite worked for me (and I think this might be a simpler solution). This is how I managed to get it to work in typescript (example using refs to focus the FormControl):
Make sure you've imported ReactDom:
import * as ReactDOM from 'react-dom';
In your component:
public focus():void {
let input = ReactDOM.findDOMNode(this.refs["titleInput"]) as HTMLInputElement;
input.focus();
}
render() {
return (
);
}