kriasoft / isomorphic-style-loader

CSS style loader for Webpack that is optimized for isomorphic (universal) web apps.
https://reactstarter.com
MIT License
1.27k stars 144 forks source link

Broken on React 16.10 - Invariant Violation: Invalid hook call. Hooks can only be called inside of the body of a function component. #170

Open damiangreen opened 5 years ago

damiangreen commented 5 years ago

Stack trace:

  - react.development.js:1533
    [my-code/[isomorphic-style-loader]/[react]/cjs/react.development.js:1533:26

  - react.development.js:1536 resolveDispatcher
    [my-code/[isomorphic-style-loader]/[react]/cjs/react.development.js:1536:5

  - react.development.js:1541 Object.useContext
    [my-code/[isomorphic-style-loader]/[react]/cjs/react.development.js:1541:20

  - useStyles.js:21 useStyles
    [my-code/[isomorphic-style-loader]/src/useStyles.js:21:25****

I suspect this line https://github.com/kriasoft/isomorphic-style-loader/blob/a990d947e79b47251f1af827adc81918494413fd/src/useStyles.js#L29 is breaking the rule of hooks because it is running an effect conditionally

async3619 commented 5 years ago

duplicated with #155

unbugx commented 3 years ago

unfortunately, this package looks like abandoned :( I used this to be sure that everything uses this version react in package.json:

"resolutions": { "react": "17.0.1", "react-dom": "17.0.1" },