Home > Back-end >  React-Native Real-Time Firebase How to find all child components(all references)?
React-Native Real-Time Firebase How to find all child components(all references)?

Time:12-15

I want to get all child components without writing anything.

I want to get all all references in a database link.

I want to enter a database link and get all references.In react-native.

I tried those funtions in the link below but couldn't get them work. enter image description here

CodePudding user response:

you can do like this :-

DatabaseReference myRef = FirebaseDatabase.getInstance().getReference().child("Frist Child").child("Second Child");

CodePudding user response:

I wrote "/" to ref and I got all the things.

      
      const firebaseMain = firebase
      .app()
      .database('https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/')
      .ref('/');
      
      console.log("CHILDREN:");
      firebaseMain.ref.once('value', function(snapshot) {
        console.log(JSON.stringify(snapshot.val()));
        firebaseReferences=snapshot.val();
        console.log("\x1b[32m","references: --> TYPE" typeof firebaseReferences );
      });

  • Related