0

i have installed the firebase(npm i firebase) all the installed npm,s are latest to their version

imported code like so-

import firebase from "firebase/app";

import config from "./config.json";

import "firebase/firestore";

import "firebase/auth";

import "firebase/storage";

firebase.initializeApp(config);

let provider = new firebase.auth.GoogleAuthProvider();

export const auth = firebase.auth();

export const firestore = firebase.firestore();

export const storage = firebase.storage();

export const signInWithGoogle = () => {

  auth.signInWithPopup(provider);
};

export default firebase;

code where i use it:-

import { signInWithGoogle } from "./firebase"

let Login=()=>{

    return(

        <button 

            onClick={()=>{

                signInWithGoogle();

            }}

        >click to sign</button>

    );

}

export default Login;
Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
  • @Dharmaraj Nah i bet he need an answer for react js to. XD – Mises Jan 08 '22 at 17:28
  • I'm not sure if the solution would be be any different. Have you tried adding "compat" in all imports like this `import "firebase/compat/[SERVICE]";` ? Apart from that, do checkout on upgrading to modular SDK in the [documentation](https://firebase.google.com/docs/web/modular-upgrade) – Dharmaraj Jan 08 '22 at 17:32

0 Answers0