DEV Community

Discussion on: Async code: return vs return await

Collapse
 
tanvirrb profile image
Tanvir Islam

Which one is more preferable, in case of performance?

Collapse
 
ivandotv profile image
Ivan V. • Edited

Sorry for a late reply (notifications on dev.to are crazy stupid).

In case of return await it will have one more microtask, you can think of it as one more then() added to the promise chain. So if you need to catch the error that is what you should use. If you plan on handling errors somewhere else in your code then just use return (without await).

Collapse
 
tanvirrb profile image
Tanvir Islam

thank you <3