Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
Why is it ok to instantiate a class without the 'new' keyword in React?

I am studying Firebase's Google authentication in React. And while following the instruction, I realize that you can instantiate a class from firebase with and without the 'new' key word. I thought in OOP, we have to use the 'new' keyword to instantiate a class and without the 'new' keyword, it's just like calling a function in JS. Can someone please explain why we can instantiate a class like calling a js function here? And what are the differences between those two?

import {initializeApp} from 'firebase/app';
import {getAuth, signInWithRedirect, signInWithPopup, GoogleAuthProvider} from 'firebase/auth'
import {getFirestore, doc, getDoc, setDoc} from 'firebase/firestore'


const firebaseConfig = {
    apiKey: "AIzaSyDwATEHxMW00am02mknls6oWdQLXmWPeuc",
    authDomain: "reactjs-ver1.firebaseapp.com",
    projectId: "reactjs-ver1",
    storageBucket: "reactjs-ver1.appspot.com",
    messagingSenderId: "631316016514",
    appId: "1:631316016514:web:776f3090371772df33339b"
  };



const firebaseApp = initializeApp(firebaseConfig);



const provider = new GoogleAuthProvider(); 
provider.setCustomParameters({
    prompt: "select_account"
})


export const auth = getAuth();   multiple instances of provider
export const signInWithGooglePopup = () => signInWithPopup(auth, provider);
export const db = getFirestore()
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda