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

125
Views
why this don't render it self when it changes username. got from firebase in react

when a User SignUP, in the Header I want to display his name, But it shows null, When I refresh the page it shows the correct name. why this is not auto rendering on changing username.

homepage.js

const [username, setusername] = useState('loading..')
 
    useEffect(() => {
       setusername(auth.currentUser.displayName);
    }, [[auth.currentUser.displayName]])
     // Some more work here
     return(
// display Name
)


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

0

First, you tell it to only run useEffect once when you pass in an empty array, second, you can't assign to username directly, you need to use the setusername function. You probably just need to do

useEffect(() => {
   setusername(auth.currentUser.displayName);
}, [auth.currentUser.displayName])
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!