0

I'm currently learning react native. I use firebase realtime database. after I initialized the configuration, I try to call .database(). but i got an error says database is not a function. anyone knows how to solve it?

import firebase from "firebase/app"

const firebaseConfig = {

     ....

}

firebase.initializeApp(firebaseConfig);

const db = firebase.database();

export default firebase

enter image description here

1 Answer 1

2

You need to import firebase/database function into your project specifically. See Setup Step 2.

Your file should look like this

import firebase from "firebase/app"
import "firebase/database"

const firebaseConfig = {

    ....
}

firebase.initializeApp(firebaseConfig);

const db = firebase.database();

export default firebase;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.