Reputation: 2109
Is it a good practice to use promises inside a promise?
Thank you.
Upvotes: 2
Views: 1090
Reputation: 2244
A cleaner way would be to chain the promises, you can create another promise inside the .then() function and return it. so that way you can chain the .then() functions, like this:
getUserPromise().then(doSomethingFunction).then(doSomethingElseFunction)
Upvotes: 1
Reputation: 411
There is no problem using promises inside promises, it is even required sometimes to create fully asynchronous scripts.
Upvotes: 6