如何在react.js中清除不受控制的textarea?

raw*_*bee 3 reactjs

我可以使用以下方法获得价值:

this.refs.myTextArea.getDOMNode().value
Run Code Online (Sandbox Code Playgroud)

试图设置它什么都不做.

goo*_*gic 6

this.refs.myTextArea.getDOMNode().value ="";

  • 在较新版本的React中,`React.findDOMNode(this.refs.myTextArea).value =""` (2认同)

Vin*_*ing 6

即使是更新版本的React(> v15),你也不需要findDOMNode(),this.refs.myTextArea.value =''就足够了