'Error @signUp: [TypeError: undefined is not an object (evaluating 'firebase.createUser')]

I'm trying to implement my signUp screen here is the signup handle that is being called, the signup page calls, and pass in the value to my context page.

const handleSignup = async () => {
    setLoading(true)

      const user = { fullname, email, password, profilePhoto};

    try {

      const createdUser = await firebase.createUser(user)

      setUser({ ...createdUser, isLoggedIn: true });
    } catch (error) {

      console.log("Error @signUp: ", error);

    } finally {

      setLoading(false)

    }
  };

the firebaseContext page then takes in the value that has been passed in creates the account

    const FirebaseContext = createContext();
    
    if(!firebase.apps.length){
        firebase.initializeApp(auth);
    }
    
    const db = firebase.firestore();
    
    const Firebase = {
        getCurrentUser: () => {
            return firebase.auth().currentUser
        },
    
        createUser: async (user) => {
            try{
                 await firebase.auth().createUserWithEmailAndPassword(user.email, user.password);
                 const uid = Firebase.getCurrentUser().uid;
    
                 let profilePhotoUrl = "default";
    
                 await db.collection("users").doc(uid).set({
                     fullname: user.fullname,
                     email: user.email, 
                     profilePhotoUrl
                 })
    
                 if(user.profilePhoto){
                    profilePhotoUrl = await Firebase.uploadProfilePhoto(user.profilePhoto);
                 }
    
                 delete user.password;
    
                 return { ...user, profilePhotoUrl, uid};
    
            }catch(error){
                console.log("Error @createUser", error.message);
            }
        },

Exporting the file

import { FirebaseContext, FirebaseProvider, Firebase } from './FirebaseContext';
import { UserContext, UserProvider } from './UserContext';


export { FirebaseContext, Firebase, FirebaseProvider, UserContext, UserProvider };

Importing the file

import { FirebaseContext } from "../context";


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source