react-jss 10.7.0 broke useStyle()
See original GitHub issueExpected behavior:
Use useStyle
without arguments. It works in <=10.6.0
.
Describe the bug:
I updated to 10.7.0 and found the following error.
Cannot read property 'theme' of undefined
.
It looks like an error was reported here 👇 https://github.com/cssinjs/jss/blob/v10.7.0/packages/react-jss/src/createUseStyles.js#L43
I updated to 10.7.0 and found that previously normal code was reporting the following error, which appears to be reported here.
Reproduction:
const useLabelStyles = createUseStyles({
label: {
color: "red"
}
});
const Label = ({ children }) => {
const classes = useLabelStyles(); // <=== Here
return <label className={classes.button}>{children}</label>;
};
I copied the example code from the official website and reproduced the problem on CodeSandbox. https://codesandbox.io/s/react-jss-1070-broke-usestyle-zv6lg
Versions (please complete the following information):
- react-jss: 10.7.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Introducing Hooks - React
Hooks don't contain any breaking changes. Available now. Hooks are now available with the release of v16.8.0. There are no plans to remove...
Read more >React with MUI's useStyles() giving me a hooks rules violation
The app returns no errors on npm start , but the page itself gives me the invalid hook call pointing to the line...
Read more >Bug: React 18 types broken since the type release a ... - GitHub
A few hours ago, a major version of React types for Typescript was released. I have tried to test this right away to...
Read more >Troubleshooting - Material UI - MUI
There are two reasons why component styles may be broken after you've completed all steps in the migration process. First, check if you...
Read more >How To Style React Components | DigitalOcean
Writing style strings manually is difficult to do and can introduce bugs. A missing color or semicolon will break the entire string. Fortunately ......
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
released in https://github.com/cssinjs/jss/releases/tag/v10.7.1
I have this problem too @kof