Material-UI和Gatsby官方示例 [英] Material-UI and gatsby official example

查看:244
本文介绍了Material-UI和Gatsby官方示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根据官方示例使用了gatsby和材质UI,我想知道是否必须将withRoot包装器添加到使用MUI的每个组件中,或者我是否可以包装要使用的最高级别的组件MUI?

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?

我在渲染和IDK方面遇到了麻烦,如何找到原因.在dev中,一切工作正常,但在prod中,<Grid>对齐方式已关闭,并且在初始渲染时未应用任何样式.在第一种涂料之后第二或第二次应用.

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.

推荐答案

开始使用 MaterialUI .

经过一番研究基于GitHub上非常有用的评论. 我总结了自己的经验(带有指向上述评论和解决方案的链接),这是GitHub上的一个问题.您可以在此处找到它们.

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.

这篇关于Material-UI和Gatsby官方示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆