我试图在我的一个组件的另一个道具中执行道具。基本上我必须等待一些数据从API返回,然后我想执行下一个道具。这是我的组件2道具代码:
getReportId = () => {
// here I make a call to the API to get a unique report ID
// then I set the state of my component to the ID's value and try call the next function
this.setState({
reportID: reportID
});
//here is where im trying to move onto the next part but its not firing
this.getReportData;
}
getReportData = () => {
// here would be part 2 where I would get the data based off the report ID but its not firing..
}
不确定这是否是React开始时的正确方法?如果是这样,那么不确定为什么道具没有开火...