I keep encountering this issue while attempting to load the page
Error: (0 , lib_AuthContext__WEBPACK_IMPORTED_MODULE_1_.useAuth) is not a function
On a side note, signing in and signing up are functioning correctly
AuthContext.js
"use client";
import { createContext, useContext, useEffect, useState } from "react";
import { onAuthStateChanged, getAuth } from "firebase/auth";
import { auth } from "./firebase";
const AuthContext = createContext();
export const AuthProvider = ({ children }) => {
const [user, setUser] = useState(null);
useEffect(() => {
const unsubscribe = onAuthStateChanged(auth, (user) => {
setUser(user);
});
return () => unsubscribe();
}, []);
return (
<AuthContext.Provider value={{ user }}>{children}</AuthContext.Provider>
);
};
export const useAuth = () => useContext(AuthContext);
Navbar.jsx
const { user } = useAuth();
{user ? (
<span className="navbar-user-email">{user.email}</span>
) : (
<>
<Link href="/auth/login" className="navbar-link">
Login
</Link>
<Link href="/auth/signup" className="navbar-link">
Sign Up
</Link>
</>
)}
I have tried numerous solutions but nothing seems to resolve the issue