Styled-components media queries

・1 min read

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

  • with interpolated string like:
      styled.div`
        ${media.mobile`
          color: red
        `}
      `
  • or returning only @media string fragment like (eg. @media (min-width: 100px):
      styled.div`
        ${media.mobile} {
          color: red
        }
      `

What disadvantages / caveats of this two approach?

DISCUSS
Classic DEV Post from Nov 19 '18

The node_modules problem

Why node_modules is so heavy and can be done to solve it?