'auth is not a function

I'm trying to do a simple login form, and Firebase auth give me this error

TypeError: firebase__WEBPACK_IMPORTED_MODULE_1_["default"].auth is not a function. (In 'firebase__WEBPACK_IMPORTED_MODULE_1_["default"].auth()', 'firebase__WEBPACK_IMPORTED_MODULE_1_["default"].auth' is undefined)

Somebody have the solution?

import React, {useEffect, useState} from "react"
import app from '../firebase'

export const AuthContext = React.createContext();

export const AuthProvider = ({ children }) => {
    const [currentUser, setCurrentUser] = useState(null);

    useEffect(() => {
        app.auth().onAuthStateChanged(setCurrentUser);
       }, []);

       return (
           <AuthContext.Provider value={{currentUser}}>
               {children}
           </AuthContext.Provider>
       )
}


Solution 1:[1]

const useAuth = () => useContext(AuthContext);

export { useAuth, AuthProvider };

add these two lines at the end also

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Shilpe Saxena