JSFiddle - React, Tailwind, and code Playground

by Prathameshsb

JavaScript

const QUESTION_URL = "https://www.algoexpert.io/api/fe/questions";
const SUBMISSION_URL = "https://www.algoexpert.io/api/fe/submissions";
async function fetching(url1, url2) {

  const [res1, res2] = await Promise.all([fetch(url1), fetch(url2)]);
  return await Promise.all([res1.json(), res2.json()]);
}

fetching(QUESTION_URL, SUBMISSION_URL)
	.then(([data1, data2]) => {
		mapQuestions(data1);
    mapSubmissions(data2);
  })
  .catch(err => console.lor(err));