Skip to content
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

Merged
merged 7 commits into from
Jul 27, 2020
Merged

Firebase init #9

merged 7 commits into from
Jul 27, 2020

Conversation

ianmah
Copy link
Contributor

@ianmah ianmah commented Jul 24, 2020

Closes #7

@ianmah ianmah requested a review from jackyzha0 July 27, 2020 16:56
import firebase from 'firebase/app'
import 'firebase/firestore'

if (!firebase.apps.length) {
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the singleton

Copy link
Contributor

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 => {
Copy link
Contributor

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?

Copy link
Contributor Author

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 => {
Copy link
Contributor

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

Copy link
Contributor

@jackyzha0 jackyzha0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥚 nice

@ianmah ianmah merged commit a3dad6a into master Jul 27, 2020
@ianmah ianmah deleted the firebase-init branch July 27, 2020 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connect Firebase
2 participants