Using React.findDOMNode in TypeScript

后端 未结 5 557
难免孤独
难免孤独 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 17:17

    References in React doesn't work like this. To get the DOM element of reference, you need to ask it in that way :

    let authorElement = this.refs.author.getDOMNode();
    

提交回复
热议问题