Async/await won't do much (if anything at all) in this kind of situation. To really use async/await effectively, you should use it in situations where delay is involved (such as an HTTP request or a database query)
As for the error you are receiving, your function must have return statement at the bottom and the returned value must be a promise
const fn = async (): Promise<void> => {
await myStore.openDialog(
<SomeComp onFinish={() => myStore.closeDialog()} />
);
someOtherFn();
return new Promise((resolve, reject) => {
// Handle promise here
})
};
...
<OtherComp
someProp={
async () => {
await fn();
someOtherFunction();
}
}
/>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…