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

137
Vistas
What is the optimal way to build a reusable component in React?

say when it comes to building a button in a component library I have 2 (probably more) choices

<PrimaryButton /> or <Button primary /> if we go on the assumption I've built my own button component

I know perhaps it's a discretion decision and both have pros and cons. But for me primary buttons should have loading states and secondary buttons should not (as just one example).

With the second approach <Button secondary loading/> there is no way to not have loading show on the secondary button UNLESS you do conditional logic at the button level which I think is a part of a design smell.

Whereas defined as <PrimaryButton /> or <SecondaryButton /> you can define at the prop level.

I'm wondering if there is a good argument for doing the second approach over the former or if it's just a matter of preference.

about 4 years ago · Santiago Gelvez
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