React apollo+material ui:服务器端渲染不适用于express



我有一个大问题,要使用graphql(react apollo(和material ui为一个完整的react应用程序制作样板。我尝试了很多大便,但我总是遇到同样的问题:

Warning: Prop "className" did not match. Server: "MuiSvgIcon-root-60 MuiListItemIcon-root-127" Client: "MuiSvgIcon-root-60 MuiListItemIcon-root-123"

如果我被记录了(问题明显来自抽屉组件(,并且:

Warning: Did not expect server HTML to contain a <h1> in <div>.

如果我注销(抽屉没有显示(。

您可以在此处找到完整的示例:https://github.com/CocoJr/docker-sf4-elasticsearch-graphql-react-express/tree/master/volumes/node

这是我的server.js文件:https://github.com/CocoJr/docker-sf4-elasticsearch-graphql-react-express/blob/master/volumes/node/src/server.js

太多人了。

我解决了我的错误:

https://github.com/mui-org/material-ui/issues/10649#issuecomment-408624288

在你的bash中使用这个很好:sed -i 's/material-ui/core/SvgIcon/material-ui/core/es/SvgIcon/' 'node_modules/@material-ui/icons/es/utils/createSvgIcon.js'

请确保始终使用material ui的/es版本,尤其是带有@material-ui/icons/…=>的SvgIcon@材料ui/icons/es/。。。

最新更新