Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
Hey, I am new to React and Node Js. My issue is I am getting slow response on third axios request that is looped. The page loads but not the data

I am new to React and Node Js and I am currently facing this problem of not being able to store data received from axios, which is inside a map() function.


const [novelArray,setNovelArray]  = useState([]);
const item_array = [];
useEffect(async () => {
   //GET DATASET OF USERS WITH  RATING
   const request1 = await axios.get(
     "http://localhost:5000/recommendation-object"
   );
   const response1 = request1.data;

   //SEND DATA FROM RESPONSE1 TO REQUEST2 AND GET ITEM RECOMMENDATION LIST FOR CURRENT USER
   const request2 = await axios.post("http://localhost:5000/recommendation-algorithm",
        { 
        data: response1, 
        user1: "user123"        
        }
  );
   const response2 = request2.data;

   //MAP ARRAY ITEM AS ITEM_ID FROM RESPONSE2 , POST AND RECEIVE ITEM_NAME
   response2.map(async (x) => {
     const request3 = await axios.get(`http://localhost:5000/novels/${x[0]}`);
     const response3 = request3.data[0];
     item_array.push(response3);
   //   setNovelArray(item_array);
   });
   setNovelArray(item_array);
 }, []);```
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!