Mapping Through Props In Styled Components
As noted in this answer it is possible to greatly simplify the amount of code needed to check for props in Styled-Components. For example, compare this code: ${props => O
Solution 1:
This one is very simple, you check if props.small
is a property of colors
and if yes, just return the value colors[props.small]
.
${props => colors[props.small] && `@media(min-width: 600px) {color: ${colors[props.small]};}`}
Post a Comment for "Mapping Through Props In Styled Components"