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

103
Views
Context returning blank screen in user authentication set up with firebase

I'm trying to set up user authentication with firebase. Everything has been working so far but when I write const {signup} = useAuth() in the file that actually renders the login page, the page turns blank.

There is a context file set up with

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}

With my RenderPage everything is working correctly, it's just a basic JSX/HTML return function with

import {useAuth, AuthProvider} from '../Contexts/AuthContext' 
import React, { useState, useRef } from "react";

function RenderPage() {
 return( 
<AuthProvider>
<h1>Generic text</h1>
<AuthProvider>)}
export default RenderPage;

And everything works perfectly,

But then when I put in the line const {signup} = useAuth() to make it:

import {useAuth, AuthProvider} from '../Contexts/AuthContext' 
import React, { useState, useRef } from "react";

function RenderPage() {
const {signup} = useAuth()
 return( 
<AuthProvider>
<h1>Generic text</h1>
<AuthProvider>
);

The page turns blank.

Does anyone have any idea why this might be? (I already checked the firebase API key and set it up on the realtime database)

Thanks in advance

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!