JSFiddle - React, Tailwind, and code Playground
JavaScript
//The catch callback is executed when the promise is rejected:
new Promise(function(resolve, reject) {
// A mock async action using setTimeout
setTimeout(function() { reject('Done!'); }, 3000);
})
.then(function(e) { console.log('done', e); })
.catch(function(e) { console.log('catch: ', e); });