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

118
Views
¿Cómo guardar el conjunto en Estado cuando se usa AppContext ()?

Quiero recibir el estado Autenticado en Home.js pero cuando lo cambio antes, en Login.js a verdadero (lo vi en useEffect -->true), useAppContext() en Home.js devuelve el estado anterior -- > falso (el antiguo en App.js) ¿no es el último cambio en el inicio de sesión?

 //----------------------in App.js---------------------- var [isAuthenticated, userHasAuthenticated] = useState('false'); <AppContext.Provider value={{ isAuthenticated, userHasAuthenticated }}> //... </AppContext.Provider> //-------------- in Login.js--------------------- const { isAuthenticated, userHasAuthenticated } = useAppContext(); useEffect(() => { console.log(isAuthenticated); // true }, [isAuthenticated]); const login = () => { userHasAuthenticated('true'); window.location.assign("/Home"); } // ---------------------in Home.js------------------------ const { isAuthenticated,userHasAuthenticated } = useAppContext(); console.log(isAuthenticated);// --->false ?
about 4 years ago · Juan Pablo Isaza
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!