Click here to Skip to main content
15,123,118 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I tried using this codes. I am trying to retrieve data from Firebase Realtime Database and I want to display the data at material table.

What I have tried:

const [fireDBdata, setfireDBdataData] = useState({});

    useEffect(() => {
                fireDb.child("data/members").on("value", (snapshot) => {
                  if (snapshot.val() !== null) {
                    setfireDBdataData({ ...snapshot.val() });
                  } else {
                    setfireDBdataData({});
                  }
                });
            
                return () => {
                    setfireDBdataData({});
                };
              }, []);
    
    const columns = ["Name", "Title", "Location"];
     const data = [fireDBdata.name, fireDBdata.title, fireDBdata.location]
    
     <MUIDataTable
            title={"Member list"}
            data={data}
            columns={columns}
            options={options}
          />
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900