When to use Promise over observable?

前端 未结 5 1706
梦毁少年i
梦毁少年i 2021-02-13 04:56

Is there any case, where Promise is more powerful as compare to observable? I know a lot of benefits of observables over promises. But Is there any case, I should use only promi

5条回答
  •  后悔当初
    2021-02-13 05:12

    Promises are eager, hence use them where you want something to happen immediately without any trigger. whereas Observable are lazy, which can be used to do something that requires some triggers either from input or something else and does not need to be happen immediately the app is loads

提交回复
热议问题