小编mrh*_*fat的帖子

您提供的函数在上下文中没有主题。父元素之一需要使用 ThemeProvider

我正在项目中创建导航栏。在我的项目中我使用

  • mui/图标材料:^5.2.5
  • mui/材料:^5.2.6
  • mui/样式:^5.2.3
现在我的文件夹结构是
  • 根.jsx
    • 导航栏.jsx
    • 样式.js
我有一个错误
The `styles` argument provided is invalid. 
You are providing a function without a theme in the context. 
One of the parent elements needs to use a ThemeProvider.
Run Code Online (Sandbox Code Playgroud)
我尝试修复
  • 在 Root.jsx 添加 ThemeProvider
  • 从 Root.jsx 中删除并添加到 Navbar.jsx
  • & 其他的

注意:我不了解 Material UI。请帮助我摆脱这个错误。我在这里提供我的代码。

代码
  • 代码Root.jsx
The `styles` argument provided is invalid. 
You are providing a function without a theme in the context. 
One of the parent elements needs to use a …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs material-design material-ui

7
推荐指数
2
解决办法
2万
查看次数