Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

85
Views
React authentication isn't updating properly

when i have my functions in UserAuthContext.js my App isn't working properly. I try to login but the user is not directet to /browse as it should. But if i put the same code in app.js i can create and login with an account. I don't know what the reason is here is the code https://codesandbox.io/s/cool-euler-eicfr?file=/src/App.js -not working version (above code belongs to this): https://not-working.netlify.app/ -working version where i have the code in app.js https://netflix-clone-kasamtde.netlify.app/

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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";


render(
  <React.StrictMode>
    <UserAuthContextProvider><App /></UserAuthContextProvider>
  </React.StrictMode>,
  document.getElementById('root')
);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!