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

79
Views
useState in React Native fails to mount new value?

Trying to retrieve a list of numbers for which will be used later on to retrieve more data.

const [listData, setList] = React.useState();

  let tempSim = Temp();

  const setLog = async() => {
    const array = [];
    const date = getDate();
    const dbCon = database.ref('Conditions/Log/Temp/' + date);
    await dbCon.get().then((snapshot => {
      snapshot.forEach(data => {
        array.push(data)
      })
    }))
    dbCon.off()
    console.log(array)
    setList(array)
    console.log(listData)
  }

The array prints fine with all the correct data, however as soon as I set the state and try print that the only output I've been able to get is undefined?

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!