Rafal Lesniak
Rafal Lesniak

Reputation: 556

Styled components and media queries

In company we want to create some styled-component util to write elegant media-queries and we are arguing which way to choose:

What are disadvantages / caveats of this two approach?

Upvotes: 1

Views: 476

Answers (1)

probablyup
probablyup

Reputation: 8134

I highly recommend the second approach, and that's how it's been implemented at the two companies I've worked at using styled-components.

The reason why I don't recommend the first approach is it ends up doing more work. Tagged template literals cut up the string into an array which causes unnecessary memory pressure, where the second strategy of interpolating in a simple string is lighter-weight.

Upvotes: 2

Related Questions