Material-UI and gatsby official example

蓝咒 提交于 2019-12-22 09:38:23

问题


I am using gatsby and material UI according to the official example and I am wondering if I have to add the withRoot wrapper to EVERY component that uses MUI or if I can just wrap the highest level component that I want to use MUI?

I am having trouble with the render and IDK how to track down the cause. In dev everything works great, but in prod, <Grid> alignments are off and on the initial render, there are no styles applied. They are applied a second or two after the first paint.

I have followed the example exactly and wrapped only my global layout component.


回答1:


I experienced the sames issues when starting to work with gatsby 2 (latest beta) and MaterialUI.

After some research I stumbled upon very helpful comments on GitHub. I summarized my learnings (with the links to the mentioned comments and solutions) in one of the issues on GitHub. You can find them here.

I hope this helps you and others.



来源:https://stackoverflow.com/questions/50376660/material-ui-and-gatsby-official-example

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!