问题
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