Using React.findDOMNode in TypeScript

后端 未结 5 561
难免孤独
难免孤独 2021-02-04 16:24

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         


        
5条回答
  •  一整个雨季
    2021-02-04 16:55

    I found this way to solve this issue.

    const author = (ReactDOM.findDOMNode(this.refs.author) as HTMLInputElement).value;
    

提交回复
热议问题