I am trying to create a chatroom application using react and firebase. Initially, I got an error while importing auth and firestore at once i.e import { auth, firestore } from 'react';, I tried firebase.auth(); and firebase.firestore(); and I got an error saying that 'auth not defined no-def' and 'firestore not defined no-def', now I have tried const auth = firestore.auth(); and const firestore = firebase.firestore() and I now get an error "Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app)."...could someone please help me
Attached is my code
import firebase from 'firebase';
//import 'firebase/app';
//import { auth, firestore } from 'firebase';
//firebase.auth();
//firebase.firestore();
const auth = firebase.auth();
const firestore = firebase.firestore()
export const signup = (user) => {
return async (dispatch) => {
const db = firestore();
auth()
.createUserWithEmailAndPassword(user.email, user.password)
.then(user => {
console.log(user);
})
.catch(error => {
console.log(error);
})
}
}