Created
May 6, 2020 16:30
-
-
Save LeilaniL/02f9f1756de46eeaa7bf62b9332a4917 to your computer and use it in GitHub Desktop.
Helping troubleshoot a Redux Firestore project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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