I write styled components like in react-native, as a js object:
const SectionTitle = styled.div({
fontSize: '25px',
display: 'flex',
})
Is it possible to use media queries with the above object style?
asked Nov 23, 2018 at 8:55
Fellow Stranger
34.4k38 gold badges181 silver badges251 bronze badges
1 Answer 1
Yes, this is possible. You just need to wrap your object keys with quotes to form a string from a media query rule.
For example:
const SectionTitle = styled.div({
fontSize: '25px',
display: 'flex',
'@media(min-width: 788px)': {
fontSize: '40px'
}
})
answered Nov 23, 2018 at 9:04
falinsky
7,4654 gold badges34 silver badges59 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Explore related questions
See similar questions with these tags.
lang-js