I am reviewing some code, it looks like this:
const doTwoThings = async() => {
const { foo } = await doThingA();
return await doThingB(foo);
}
I would re-write this as
const doTwoThings = () => {
return doThingA().then(({ foo }) =>
doThingB(foo);
);
}
Is there any difference between these two (performance, error handling, etc)? Or is it just my stylistic preference?