2

Is it a good practice to use promises inside a promise?
Thank you.

1

2 Answers 2

6

There is no problem using promises inside promises, it is even required sometimes to create fully asynchronous scripts.

Sign up to request clarification or add additional context in comments.

Comments

1

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)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.