isomorphic-style-loader icon indicating copy to clipboard operation
isomorphic-style-loader copied to clipboard

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

Open damiangreen opened this issue 6 years ago • 2 comments

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

damiangreen avatar Oct 02 '19 15:10 damiangreen

duplicated with #155

async3619 avatar Oct 31 '19 23:10 async3619

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" },

unbugx avatar Dec 24 '20 16:12 unbugx