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

145
Views
value is becoming false in contextAPI in react

I have to send values as true or false to another component in react.

so in my A component I am writing.

  <Name.Provider value={true}>
        </Name.Provider>

and in my B component I am writing

                            <Name.Consumer>
                            {
                            
                               value => 
                                  <span className="badge badge-white">
                                   {value && <Link to="user"> List of Users</Link>} 
                                 </span>
                            }
                          </Name.Consumer>

since I am passing true to B, it should display the List of Users , but it is not displaying. could you please tell me what wrong I am doing?

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

0

You need to provide that value to the link, I don't see in your code where are you providing that value, but you can have a look at this blog posts:
https://kentcdodds.com/blog/how-to-use-react-context-effectively
https://dmitripavlutin.com/react-context-and-usecontext/

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!