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

112
Views
Render data from a database

Say I want to fetch someone's name from a firebase database to render in JSX for a React Native project. I want to render something as follows

return(
 <View>
   <Text>{name} retrieved data!</Text>
 </View>)

Where name is some data stored in the realtime database. To get the "name" variable, I would need to make an async call to the database. However, I only want to render the JSX if I have the correct value for name. How can I go about doing this? I realize this is a simple example, but that was the point, as I spent hours trying to figure out the answer to a more complex version of this. When trying to do this, I would get an error since name was undefined at the time of rendering due to the async call to the database.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you don't have the data yet, you can render something else while you're still loading.

For example something like:

if (!name) {
  return null
}

return (
  <View>
    <Text>{name} retrieved data!</Text>
  </View>
)

Some kind of loading indicator would probably be better than the null.

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!