I'm using React hooks + firebase.
In firebase, I created a collection called "projects"
When I try to console log the data with:
const Dashboard = () => {
const { firebase } = useContext(GlobalContext);
return (
<div className="container">
{console.log(firebase.db.collection("projects"))}
</div>
);
};
I'm getting the following object:
Shouldn't be able to see my data?
Below are my firebase and context set up
firebase.js
import app from "firebase/app";
import "firebase/auth";
import "firebase/firebase-firestore";
const config = {//mydata}
class Firebase {
constructor() {
app.initializeApp(config);
this.auth = app.auth();
this.db = app.firestore();
}
}
export default new Firebase();
context.js
import React, { useReducer } from "react";
import { projectReducer } from "./reducers";
import firebase from "../components/firebase/firebase";
export const GlobalState = props => {
const [projects, setProjects] = useReducer(projectReducer, []);
return (
<GlobalContext.Provider
value={{
projects,
firebase
}}
>
{props.children}
</GlobalContext.Provider>
);
};