Skip to content

Instantly share code, notes, and snippets.

@LeilaniL
Created May 6, 2020 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeilaniL/02f9f1756de46eeaa7bf62b9332a4917 to your computer and use it in GitHub Desktop.
Save LeilaniL/02f9f1756de46eeaa7bf62b9332a4917 to your computer and use it in GitHub Desktop.
Helping troubleshoot a Redux Firestore project
import React from "react";
import { compose } from "redux";
import { connect } from "react-redux";
import { useSelector } from "react-redux";
import {
firestoreConnect,
useFirestoreConnect,
withFirestore,
isLoaded,
isEmpty,
} from "react-redux-firebase";
import firebase from "firebase";
import Quiz from "./Quiz";
const myQuizzesReduxName = "myQuizzes";
function MyQuizList(props) {
const auth = props.firebase.auth();
const currentUserId = auth.currentUser.uid;
let db = firebase.firestore();
let quizzesRef = db
.collection("quizzes")
.where("author", "==", currentUserId);
// console.log("My Quizzes", quizzesRef.get());
let nowVisible;
quizzesRef
.get()
.then(function (myQuizzes) {
if (isLoaded(myQuizzes)) {
return (
<React.Fragment>
myQuizzes.forEach(function(doc){<div>TESTING</div>})
</React.Fragment>
)
}
})
.catch(function (error) {
console.error("Error in MyQuizList component:", error);
});
debugger;
return <React.Fragment>{nowVisible}</React.Fragment>;
}
export default withFirestore(MyQuizList);
// currentVisibleComponent =
// <React.Fragment>
// <Quiz quizName="outside!" />
// </React.Fragment>
//
// )
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment