Skip to content

setAuth is not a function handleSubmit Login.jsx #1

@junaidrao

Description

@junaidrao

Hi
I am getting this error and i am not able to figure out what is wrong with my auth hook.
useAuth.jsx

import { useContext } from "react";
import AuthContext  from "../context/AuthProvider";

const useAuth = () =>{

    return useContext(AuthContext);
}

export default useAuth;

AuthProvider

import { createContext, useState } from "react";

const AuthContext = createContext({});

export const AuthProvider = ({Children}) =>{
    const [auth, setAuth] = useState();
    return(
        <AuthContext.Provider value={{auth, setAuth}}>
            {Children}
        </AuthContext.Provider>
        
    )
}

export default AuthContext;

I am not able to see homepage without removing authprovider either. Anybody else faced this issue?
Any help will be much appriciated
Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions