Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda