This is my database structure

This is my database structure

I want to fetch data from it and turn it into arrays, however nothing seems to work, I can fetch single values like 'name1' or 'name2' but can't fetch it as whole.

I tried something like:

this.database = this.app.database().ref().child().child('id');
...
componentDidMount(){
  this.database.on('value', (snapshot) => {
this.setState({id: snapshot.val()})
 });
}

but it gives me an error:

Firebase: Firebase App named '[DEFAULT]' already exists (app/duplicate-app).

0 Answers