Take a look at the below code: const promise = new Promise((resolve, reject) => { resolve(); }); promise .then(() => { console.log('first'); }) .then(() => { console.log('second'); }) .then(() => { console.log('third'); }) ...

Markdown supported · ⌘↵ to post
Awesome content. Thanks Yogesh! I was wondering as for API call we mostly use axios which also returns a Promise by default, we will not have to explicitly return a promise from inside a then block. Obviously for other use cases where things don't return promise we have to do the one you did. Please correct me if I am wrong.
Himanshu Kumar
Software Developer
Great article. I have stuck in this problem before. I wonder if there's a way to solve this by using async-await instead of promises.