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

325
Vistas
How can I enable and hide [list, button, images,..etc ]by using props

so this is the component:

<ReusedHeader
  H1headerGray="text... "
  H2headerRed="text2 ! "
  pheader="p1"
  getStarted="button text1"
  hrefab="button url 1"
  whatWeDo="button text2"
  hrefbb="button url 2"
  imageSrc="image url"
/>;

the list in the component :

<li className=" hover:ring active:ring-4 w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-red-600 hover:bg-red-700 md:py-4 md:text-lg md:px-10">
  {getStarted}
</li>

And this component I will use in many places; in some places, I want the component without buttons;

how can I enable and disable buttons if possible?

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

0

You can just pass the needed props and handle the logic within the component

const ReusedHeader = ({buttonsEnabled=true}) => {
    if(buttonsEnabled){ // return something }
    else { // return something else }
}

Or modify the onClick if you want the same markup without onClick functionality.

onClick={buttonsEnabled? onClick : undefined}
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