遇到问题先百度,但是最近发现百度的内容好多都老旧了,跟不上时代,本文基于https://www.cnblogs.com/ives/p/11291769.html的内容上进行完善和补充
为什么说它旧了呢,因为在新版的react中这个已经 ref="refTest"已经废弃可以参考之前的这篇文章
react 中如何清空input的值
import React, {
Component} from 'react';
import {
findDOMNode} from 'react-dom'
export default class Relate extends Component {
constructor(props) {
super(props);
this.refTest = React.createRef();
this.state = {
showurl:false,
};
}
componentDidMount() {
document.addEventListener