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

143
Views
Pantalla en blanco de React Context

Estoy configurando la autenticación de usuario de firebase para una aplicación reactjs. Todo ha estado funcionando hasta ahora, pero cuando escribo const {signup} = useAuth() en el archivo que realmente representa la página de inicio de sesión, la página se vuelve en blanco.

Hay un archivo de contexto configurado con:

 import React, { useContext, useState, useEffect} from 'react' import {auth} from '../firebase' const AuthContext = React.createContext() function useAuth() { return useContext(AuthContext) } function AuthProvider({children}) { const[currentUser, setCurrentUser]= useState() function signup(email, password) { return auth.createUserWithEmailAndPassword(email,password) } useEffect(() => { const unsubscribe = auth.onAuthStateChanged(user => { setCurrentUser(user) }) return unsubscribe },[]); const value = { currentUser, signup } return ( <AuthContext.Provider value={value}> {children} </AuthContext.Provider> ) } export {useAuth, AuthProvider}

Con mi RenderPage todo funciona correctamente, es solo una función básica de retorno JSX/HTML con

 import {useAuth, AuthProvider} from '../Contexts/AuthContext' import React, { useState, useRef } from "react"; function RenderPage() { return( <AuthProvider> <h1>Generic text</h1> <AuthProvider>)} export default RenderPage;

Y todo funciona perfectamente,

Pero luego, cuando pongo la línea const {signup} = useAuth() para hacerlo:

 import {useAuth, AuthProvider} from '../Contexts/AuthContext' import React, { useState, useRef } from "react"; function RenderPage() { const {signup} = useAuth() return( <AuthProvider> <h1>Generic text</h1> <AuthProvider> );

La página se vuelve en blanco.

¿Alguien tiene alguna idea de por qué puede ser esto? (Ya verifiqué la clave API de firebase y la configuré en la base de datos en tiempo real)

Gracias por adelantado

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!