Observable vs Promise | When to use PromiseEDIT
Observable vs Promise | Which is better?
Observable vs Promise | When to use Promise
Observable vs Promise | When to use Observable
When you want to use async/await
async/await is a special syntax for working with Promises. It's basically syntactic sugar for making Promises easier to work with.
You can avoid a lot of "callback hell" and promise chaining by using these keywords. This makes Promises a lot easier to work with in general.
When you don't want to rely on third party libraries (RxJs)
When you want to resolve a single event
A Promise always rejects or resolves a single event. You can't emit multiple values through a Promise. It's a one and done async operation.
When your application is async by nature
When you don't want to cancel an async activity
A Promise can't be canceled. Once you create a Promise it will execute to completion. You can't cancel a Promise like you can an Observable.