Search code examples
javascriptfirebasereact-nativefirebase-realtime-databaseiot

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


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. https://firebase.google.com/docs/reference/node/firebase.database.DataSnapshot

THANKS FOR ALL THE HELP <3 enter image description here


Solution

  • 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 );
          });