react authentication is not up to date properly

You cannot use useAuthContext in a component that is not a child of UserAuthContextProvider. It will always return undefined

Easiest fix for this is to move UserAuthContextProvider into index.js:

// index.js
import React from 'react';
import {render} from 'react-dom';
import './index.css';
import App from './App';
import UserAuthContextProvider from "./components/Contexts/UserAuthContext.js";

    <UserAuthContextProvider><App /></UserAuthContextProvider>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top