Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

144
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda