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

125
Views
Why is async await returning a promise?

I am trying to return a value that updates as data loads from a database.

However, when I fetch my data using async-await, my function returns a Promise, not the end value. When I check what's being returned, I get a value, but it does not seem to be returned.

 const fetchGameItems = async (items) => {
    try {
      let gameItems = await items
      console.log(gameItems)
      return await gameItems
    } catch (err) {
      console.error(err)
    }
  }

console.log(fetchGameItems(useLoadSpecficRecords(today).games.length))

// Logs
Promise {<pending>} // (From the console.log below the function declaration) 
2 // (from the fetchItems function)

useLoadSpecficRecords is a custom hook that loads data.

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!