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

347
Vistas
React Context Api - A Context Passed through Context Provider is yet not able to accessible by Child Components

I have a component ExpandableCard and created its context ExpandableCardContext and context provider ExpandableCardProvider. Then I called the provider from some ParentComponent by passing a prop "handleCloseExpandableCard"(an arrow function) and also another prop "component" have value a ChildComponent which gets called from ExpandableCard. The problem is that ChildComponent doesn't receive "handleCloseExpandableCard" as a prop.

ParentComponent


**ExpandableCardProvider
**

**ExpandableCardContext
**

ExpandableCard
it calls the component(ParcelCardProvider) passed from "ParentComponent" and that ParcelCardProvider is not receiving "handleCloseExpandCard" as a prop.

This is the Error I'm getting. Image With error

My Guess is that parcel card is being called as a prop outside that context but at the same time it's wrapped inside the Context Provider component. Anybody here with help?
Much Appreciated. Thanks.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I've resolved this one. I was trying to import handleCloseExpandableCard as

const [handleCloseExpandableCard] = useContext(ExpandableCardContext);

but actually it needed to be import like this

const [, , handleCloseExpandableCard] = useContext(ExpandableCardContext);
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