Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

react make multiple fetch requests one after another

/*
Fetch API requesting multiple get requests
*/

Promise.all([
  fetch("http://localhost:3000/items/get"),
  fetch("http://localhost:3000/contactlist/get"),
  fetch("http://localhost:3000/itemgroup/get")
]).then(([items, contactlist, itemgroup]) => {
    ReactDOM.render(
        <Test items={items} contactlist={contactlist} itemgroup={itemgroup} />,
        document.getElementById('overview');
    );
}).catch((err) => {
    console.log(err);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #react #multiple #fetch #requests
ADD COMMENT
Topic
Name
1+5 =