Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!