-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firebase init #9
Conversation
import firebase from 'firebase/app' | ||
import 'firebase/firestore' | ||
|
||
if (!firebase.apps.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this conditional checking? To see if there's a firebase app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this file will be imported many times and we only want a single app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a good place to use a singleton?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the singleton
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh lmao all the singletons i've seen before had a slightly different structure but this works
src/App.js
Outdated
|
||
// example getting all hackathons data | ||
useEffect(() => { | ||
db.collection('Hackathons').get().then(querySnapshot => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to make a collection for each hackathon so we don't grab more info than we need?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just an example call, we can defs just grab one hackathon's data.
src/App.js
Outdated
// example getting all hackathons data | ||
useEffect(() => { | ||
db.collection('Hackathons').get().then(querySnapshot => { | ||
const paths = querySnapshot.docs.map(doc => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this var called paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥚 nice
Closes #7