我有一个文本区域
<textarea ref="newText" defaultValue={this.props.children}></textarea>
我需要获取它的值,我这样尝试过。
this.props.update(this.refs.newText.value,this.props.index);
我还使用文本而不是值,但它仍然返回未定义。
this.refs.newText.value
最佳答案
尝试更新你的react-dom库。 ref 帮助您命令式修改子项,而无需使用 props。 get the latest from react docs
src="https://unpkg.com/react@15/dist/react.js">
src="https://unpkg.com/react-dom@15/dist/react-dom.js">
关于javascript - 文本区域值和文本属性在 react 中未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39685830/