Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

snapshot.data is not a function #285

Unanswered
fredy31 asked this question in Q&A
Discussion options

Getting this error while trying to modify the tutorial for my needs.

Here is my code

import React from 'react';
import { FirebaseAppProvider, useFirestoreDocData, useFirestore, SuspenseWithPerf } from 'reactfire'
const firebaseConfig = {
 /* Add your config from the Firebase Console */
 apiKey: "x", // Auth / General Use
 appId: "x", // General Use
 projectId: "x", // General Use
 authDomain: "x", // Auth with popup/redirect
 databaseURL: "x", // Realtime Database
 //storageBucket: "x", // Storage
 //messagingSenderId: "x", // Cloud Messaging
 //measurementId: "x" // Analytics
};
function PixFirebaseData(){
 const dataRef = useFirestore().collection('events')
 const burrito = useFirestoreDocData(dataRef);
 console.log(burrito)
 //return <p>The burrito is {burrito.events.event.name}!</p>;
 return <p>Test</p>
}
const TemplateDefault = () =>{
 return <FirebaseAppProvider firebaseConfig={firebaseConfig}>
 <h1>Essai Firebase</h1>
 <SuspenseWithPerf fallback={<p>Loading Firebase</p>} traceId={'testload'}>
 <PixFirebaseData />
 </SuspenseWithPerf>
 </FirebaseAppProvider>
}
export default TemplateDefault;

I've bee trying to debug this for a while but I don't even know what pushes this error. Anybody got that one before?

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #285 on December 10, 2020 00:35.

AltStyle によって変換されたページ (->オリジナル) /