1 Comment

All you need to know about promises in JavaScript

Do you know what is a promise in JavaScript? Do you know how to consume it?
A simple term of promise is that it will only return a resolved value or rejected value, it will always be in PENDING mode.

Here are the basics you need to know about promises in JavaScript.


  1. 2

    Hi Eugene,

    I see a lot of these blogs which are mostly reprints of the base documentation https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

    It would be a lot more useful if you assumed we read the base documentation already and picked up from there.

    Like for instance what happens if you try a Promise inside of a useEffect in React (as I learned the hard way it depends heavily on your useEffect dependencies). Or when you use a Promise from a button click in React make sure you return the Promise or else it won't always complete.

Trending on Indie Hackers
38% of remote employees work from bed. What about you? 14 comments Notion or Airtable for database and research based products? 10 comments Twitter accounts directory 5 comments I started The Peak (Morning Brew for Canada) and sold $150,000 worth of ads in year 1. Here's how. 3 comments Feedback on my landing page! EasyDMARC 3 comments Launching a new feature: Video Reviews 2 comments