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

163
Views
Styled components; multiple arrow functions or combine to single?

The documentation of styled-components shows us the option to merge multiple arrow functions into one:

// go from this
const Button = styled.button`
  background-color: ${({ theme }) => theme.colors.blue};
  padding: ${({ hasSpacing }) => hasSpacing ? '10px 20px' : null};
`;


// to this
const Button = styled.button(({ theme, hasPadding }) => css`
  background-color: ${theme.colors.blue};
  padding: ${hasPadding ? '10px 20px' : null};
`);

I've seen both work in different projects, but was wondering if there is any reason to chose one above the other. To me it feels like preference, but is there also impact on performance, file size, amount of generated classes, or something else?

about 4 years ago · Juan Pablo Isaza
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!