Created
July 23, 2021 04:30
-
-
Save samarpanda/a7ac5d878cd5473b453ebb5b77345a8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const parallelFetch = async (urls) => { | |
var data = await Promise.all( | |
urls.map((fetchParams) => { | |
const { url, options = {} } = fetchParams; | |
return fetch(url, options).then((response) => response.json()); | |
}) | |
); | |
return data; | |
} | |
export default parallelFetch; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment