JSFiddle - React, Tailwind, and code Playground
by atesgoral
JavaScript
const p1 = new Promise((resolve, reject) => {
setTimeout(() => {
resolve('one');
}, 1000);
});
const p2 = new Promise((resolve, reject) => {
setTimeout(() => {
resolve('two');
}, 2000);
});
const getResults = Promise.all([ p1, p2 ]);
getResults.then((results) => {
console.log('results', results);
});