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

160
Views
how to merge two json array of objects and display in react

How can i merge this Data & display in table with map in react? Text in First Column & Count in Second

const  handleSubmit = async (e) => {
    e.preventDefault();
    
    let URL1 = "https://herokuapp.com"
    let URL2 = "https://appspot.com"
    
    const promise1 = await axios.post(URL1, inputValue , {headers: {'Access-Control-Allow-Origin': '*' , 'Content-Type': 'text/plain'}});
    const promise2 = await axios.post(URL2, inputValue , {headers: {'Access-Control-Allow-Origin': 'http://localhost:3000' , 'Content-Type': 'text/plain'}});
    
    Promise.all([promise1, promise2]).then(function(values) {
      
      setDataOne1(values[0].data);
      setDataOne2(values[1].data);
      
    }).catch(error => {
      console.log(error)
    })

    } 

Json Data First

{text: 'best movies'}

Json Data 2nd

{count: '12345'}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It is possible to use Object.assign or spread operator:

Promise.all([promise1, promise2]).then(function(values) {
  let merged = {...values[0].data, ...values[1].data};
  let mergedByAssign = Object.assign(values[0].data, values[1].data);

  setDataOne1(values[0].data);
  setDataOne2(values[1].data);
  
}).catch(error => {
  console.log(error)
})
about 4 years ago · Juan Pablo Isaza Report
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!