2

I am migrating my react front that was previously rendered along rails with react-rails to a separate react application build from scratch, when adding a component that makes use of makeStyles I get the following error:

makeStyles.js:156 Uncaught TypeError: Cannot read properties of undefined (reading 'refs')
    at detach (makeStyles.js:156:1)
    at makeStyles.js:240:1
    at makeStyles.js:194:1
    at safelyCallDestroy (react-dom.development.js:22932:1)
    at commitHookEffectListUnmount (react-dom.development.js:23100:1)
    at commitPassiveUnmountOnFiber (react-dom.development.js:25031:1)
    at commitPassiveUnmountEffects_complete (react-dom.development.js:25007:1)
    at commitPassiveUnmountEffects_begin (react-dom.development.js:24996:1)
    at commitPassiveUnmountEffects (react-dom.development.js:24941:1)
    at flushPassiveEffectsImpl (react-dom.development.js:27038:1)
detach @ makeStyles.js:156
(anonymous) @ makeStyles.js:240
(anonymous) @ makeStyles.js:194
safelyCallDestroy @ react-dom.development.js:22932
commitHookEffectListUnmount @ react-dom.development.js:23100
commitPassiveUnmountOnFiber @ react-dom.development.js:25031
commitPassiveUnmountEffects_complete @ react-dom.development.js:25007
commitPassiveUnmountEffects_begin @ react-dom.development.js:24996
commitPassiveUnmountEffects @ react-dom.development.js:24941
flushPassiveEffectsImpl @ react-dom.development.js:27038
flushPassiveEffects @ react-dom.development.js:26984
(anonymous) @ react-dom.development.js:26769
workLoop @ scheduler.development.js:266
flushWork @ scheduler.development.js:239
performWorkUntilDeadline @ scheduler.development.js:533

(I am using the 4.12 version of material ui)

Gotey
  • 449
  • 4
  • 15
  • 41
  • Hi, did you ever get an answer for this? – takanuva15 Jan 25 '23 at 20:35
  • 1
    I got the same error when using `makeStyles` from @mui/styles (Legacy MUI) in a tsx component in React 18. Then I noticed its [docs](https://mui.com/system/styles/basics/) says not compatible with React.StrictMode or React 18. Removing React.StrictMode resolved the issue. – tiwarib Mar 24 '23 at 04:03

0 Answers0