Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!