Promises have just gotten nicer! (withResolvers)

Поділитися
Вставка
  • Опубліковано 26 тра 2024
  • Promise.withResolvers() lets you create Promises in a more elegant way just by calling one function.
    ======⚡⚡⚡======
    Consider becoming a member of the channel by joining me ❤️
    / @softwaredeveloperdiaries
    ☕ Buy me a coffee: www.buymeacoffee.com/software...
    🙌 Become my Patreon and get exclusive perks: / softdevdiaries
    💼 Follow me on LinkedIn and drop me a message if you'd like: / gadirovgs
    💻 Also, let's connect on GitHub: github.com/gusgad
    📚 Resources:
    mikevdv.dev/blog/2024-03-30-p...
    And don't forget to subscribe for more videos like this 😊
  • Наука та технологія

КОМЕНТАРІ • 14

  • @RyanThickett
    @RyanThickett Місяць тому +11

    Honestly I just find the async await pattern so much cleaner anyway, stringing together .then().catch().error() etc... always looked super ugly to me, whereas having a function you can just await and then deal with however you want to after is clean.

    • @adolfomartin5456
      @adolfomartin5456 Місяць тому +1

      I agree with you. Sometimes we have to use new Promise ... but in at the moment I'm sure I've forgotten this video.

    • @SoftwareDeveloperDiaries
      @SoftwareDeveloperDiaries  Місяць тому

      I also agree, async await is always better :)

    • @sirajabbas5372
      @sirajabbas5372 4 дні тому

      For me also async await is much cleaner and readable. However this is handly where the situations we forced to use promises.

  • @chris94kennedy
    @chris94kennedy Місяць тому +5

    pretty cool, some nice sugar. Also prevents the antipattern of an async anon function in a Promise constructor

  • @sergiyrudenko905
    @sergiyrudenko905 Місяць тому

    Thank you!

  •  Місяць тому

    Awesome

  • @harrypotil860
    @harrypotil860 28 днів тому

    You promised that you would make a vedio on how Discord would have avoided Cassandra beforehand

  • @sergeyagronov9650
    @sergeyagronov9650 Місяць тому

    great video :)

  • @axel_huth
    @axel_huth Місяць тому

    👍😎👍

  • @Finn-jp6pn
    @Finn-jp6pn Місяць тому

    Can't we always use async keyword to implicitly return a promise instead of explicitly returning a new promise? 🤔

  • @mimshins
    @mimshins Місяць тому

    Why not just return Promise.resolve(data) or Promise.reject(error)?