0👍
✅
In below line, you have not declared variable app
, so it’s undefined
let db = app.database()
You can change firebase.js
to
import firebase from 'firebase'
import config from './firebaseConfig'
const app = firebase.initializeApp(config)
let db = app.database()
export default db
and from your component
import db from './firebase.js'
let booksRef = db.ref('books')
...
Source:stackexchange.com