要求你的react组件 类式组件 构造函授中 最好 要加入 this.sate={} 为空 也行 但不要不写
constructor(props){
super(props);
this.state={}
}