问题描述使用react开发过程中,用ES6语法写组件如下const Name = (props) => { this.state = { data: null, visible: false
};
const open = (data) => { this.setState({
data, visible: true
});
}
return ( <div>content</div>
);
}当执行open()时提示Unhandled Rejection (TypeError): _this.setState is not a function尝试过const that = this;that.setState({})抱一样的错误,求大佬解答。
添加回答
举报
0/150
提交
取消