如何修复material-ui-dropzone中的theme.spacing.unit警告?

时间:2019-09-19 03:14:22

标签: reactjs material-ui

我这样使用material-ui-dropzone:

//App.js
<Dropzone/>

但是此错误发生在控制台中:

 index.js:1375 Warning: Material-UI: theme.spacing.unit usage has been deprecated. It will be removed in v5. You can replace `theme.spacing.unit * y` with `theme.spacing(y)`.

如何解决此警告?

2 个答案:

答案 0 :(得分:1)

这是从v3到v4过渡以及使用间隔单位的完整文档。

链接:theme-spacing-v4

以下是有关间距单位的最常见示例:

基本间距单位

v3 theme.spacing.unit

v4 theme.spacing(1)

缩小间距

v3 theme.spacing.unit / 5

v4 theme.spacing(1/5)

扩展间距

v3 theme.spacing.unit * 5

v4 theme.spacing(5)

答案 1 :(得分:0)

拳头: 找到您的代码“ theme.spacing.unit”; 第二: 例如:“ theme.spacing.unit * 4”,请将其更改为“ theme.spacing(4)”。