Observable vs Promise | When to use Promise
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)
As of ES6, the Promise is native to JavaScript. This means you don't need any third party dependencies to make Promises work. Unlike Observables, most modern browsers support Promises natively.
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.