material-ui Drawer - findDOMNode is deprecated in StrictMode

后端 未结 4 780
广开言路
广开言路 2020-12-30 18:48

I have a simple ReactJS app based on hooks (no classes) using StrictMode.

I am using React version 16.13.1 and Material-UI version 4.9.10.

In the Appbar I a

4条回答
  •  一生所求
    2020-12-30 19:17

    According to Material-ui changelog, it should be solve in V5, which is still in alpha.

    It seems that at least in some cases this issue cause by createMuiTheme. You can solve this issue by using the experimental (unstable) theme creator

    If you want to get the experimental theme creator instead of removing React.StrictMode, you can change it's import from:

    import { createMuiTheme } from '@material-ui/core';
    
    

    To

    import { unstable_createMuiStrictModeTheme as createMuiTheme } from '@material-ui/core';
    
    

提交回复
热议问题