[react-jss] Root @media rules doesn't work with hook
See original GitHub issueExpected behavior: Generated classes of :
const styles = {
'@media (min-width: 1024px)': {
class1: {
color: 'red'
}
},
class2: {
'@media (min-width: 1024px)': {
color: 'red'
}
}
}
Should be like :
{
class1: 'class1-0-0-1',
class2: 'class2-0-0-2'
}
Describe the bug:
When using createUseStyles(styles)
(or the withStyles()
HOC), generated classes are :
{
'@media (min-width: 1024px)': undefined,
class2: 'class2-0-2-2'
}
Note that it works well when using jss.createStyleSheet(styles)
, am I missing something ?
Codesandbox link: https://codesandbox.io/s/clever-firefly-w6dh8
Versions:
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (13 by maintainers)
Top Results From Across the Web
Media query not working in React
I'm including the styles for the footer in the component so it's completely localized. For some reason, in this most basic example, @media...
Read more >Using CSS media queries in React with Fresnel
What are CSS media queries? Media queries allow developers to define different styling rules for different viewport sizes.
Read more >Solving React Hooks' invalid hook call warning
Building a React project and have the error 'Hooks can only be called inside the body of a function component'? We'll solve the...
Read more >Rules of Hooks
They let you use state and other React features without writing a class. Hooks are JavaScript functions, but you need to follow two...
Read more >Inline media query in React components
Generally, one can not do inline styling with media queries because React doesn't allow us to use media queries in inline styling. We...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
same issus happend to me.
Thank you for these explanations, I’ll get on it soon.