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

323
Views
null data included in the firebase realtime database

some null data gets included in my database when I store it on an array on my react native app even though it does not have any null entries on the firebase realtime database.

enter image description here

this is the firebase realtime database in my console.

enter image description here

This is my database get function:

  const GetDatabaseData = () =>
  {
    if(DataRendered == false)
    {
      database()
      .ref('Items/ItemInventory')
      .on('value', Snapshot => {
        var Data = []
        Snapshot.forEach((child) => {
          Data.push({
            Item_code: child.child('Item_code').val(),
            Item_name: child.child('Item_name').val(),
            Item_qty: child.child('Item_qty').val()
          })
        })
        console.log(Data)
        //setItemData(Data)
      })
    }
    else
    {
      console.log("Data Rendered")
    }
  }

it's my first time using firebase on react native so any help is appreciated.

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

0

This is the expected behavior. When Firebase sees a number of sequential, numerical keys it assumed that those are an array, and it fill missing indexes with null value.

To prevent this array coercion, use a short alphanumeric prefix on your keys, e.g. key1, key2, etc.

For more on this, see Best Practices: Arrays in Firebase.

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!