JSFiddle - React, Tailwind, and code Playground
JavaScript
//All promise instances get a then method which allows you to react to the promise.
//The first then method callback receives the result given to it by the resolve() call:
var p = new Promise(function(resolve, reject) {
// A mock async action using setTimeout
setTimeout(function() { resolve(10); }, 3000);
});
p.then(function(result) {
console.log(result);
});