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

238
Vistas
How to set props equal to dynamic value?

I am creating an array of Components:

myArray = [<Component isDisabled={myfunction}/>,<Component isDisabled ={myfunction}/>]

and then mapping it out

myArray.map((comp, index) => (comp))

I am trying to conditionally set the value of isDisabled prop with a function:

myfunction ()
{
return false
}

It is not working. I have tried to use arrow functions

<Component isDisabled={()=>myfunction()}/>
<Component isDisabled={()=>(myfunction())}/>
<Component isDisabled={()=>{myfunction()}}/>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are not setting the value of prop "isDisabled" to boolean, you are passing the whole function to it. If you want isDisabled prop to be the result of myFunction execution, you need to write it this way:

<Component isDisabled={myFunction()} />
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