【发布时间】:2021-10-05 15:51:57
【问题描述】:
我无法让 Material-ui 样式与 next.js 一起正常工作。当我更改样式然后在运行开发服务器时保存时,样式会被应用,但是如果我重新加载页面、保存任何其他更改或重新启动服务器,默认的 material-ui 样式会覆盖我的自定义样式。此外,每当我使用 Box material-ui 组件时,我都会在控制台中看到此错误:
react-dom.development.js:67 Warning: Prop `className` did not match. Server: "MuiBox-root MuiBox-root-3 makeStyles-boxStyles-1" Client: "MuiBox-root MuiBox-root-4 makeStyles-boxStyles-1"
这是我的 _document.tsx:https://pastebin.com/wJD9jyZQ
这是我的 _app.tsx:https://pastebin.com/s8Ys01kb
这是我的 index.tsx:https://pastebin.com/t5Z9QGpP
这里是 index.styles.ts(我的自定义样式所在的位置):https://pastebin.com/qe7M5ysq
【问题讨论】:
标签: reactjs material-ui next.js styled-components