我目前正在做一个项目,在这个项目中我使用了 React 和 Material-UI 框架。但是,使用 grid 后会弹出一个错误消息:
checkPropTypes.js:20 Warning: Failed prop type: The property `spacing` of `Grid` must be used on `container`.
in WithStyles(ForwardRef(Grid)) (created by NavBar)
in NavBar (created by Root)
in Root
Run Code Online (Sandbox Code Playgroud)
我已经检查了我的所有代码,并且 Grid 容器确实使用了该spacing道具。我还尝试从 Grid 项目中删除间距,这会导致更多错误。
<BrowserRouter>
<AppBar position="static">
<Toolbar style={navStyle}>
<Grid
justify="space-between"
container
spacing={10}
>
<Grid
item
spacing={2}
>
...
Run Code Online (Sandbox Code Playgroud)
然而,一切都正确地显示在屏幕上;这个错误仍然弹出。我不确定如何解决这个问题,很想学习!