【发布时间】:2019-07-15 03:37:45
【问题描述】:
我在运行 React.js 前端时收到此警告:
index.js:1446 Warning: Failed prop type: The prop `children` is marked as required in `InputAdornment`, but its value is `undefined`.
in InputAdornment (created by WithStyles(InputAdornment))
in WithStyles(InputAdornment) (at TopControls.js:101)
in div (created by InputBase)
in InputBase (created by Context.Consumer)
in WithFormControlContext(InputBase) (created by WithStyles(WithFormControlContext(InputBase)))
in WithStyles(WithFormControlContext(InputBase)) (created by Input)
in Input (created by WithStyles(Input))
in WithStyles(Input) (created by TextField)
in div (created by FormControl)
in FormControl (created by WithStyles(FormControl))
in WithStyles(FormControl) (created by TextField)
in TextField (at TopControls.js:91)
in div (created by Grid)
in Grid (created by WithStyles(Grid))
in WithStyles(Grid) (at TopControls.js:90)
in div (created by Grid)
in Grid (created by WithStyles(Grid))
in WithStyles(Grid) (at TopControls.js:89)
in div (at TopControls.js:22)
in TopControls (at BatchFlights.js:147)
in BatchFlights (created by WithStyles(BatchFlights))
in WithStyles(BatchFlights) (at App.js:23)
TopControls.js 中的第 10-102 行包含以下代码:
InputProps={{
startAdornment: <InputAdornment position="start"></InputAdornment>,
}}
有人可以解释什么是错的,我该如何避免这个警告?
【问题讨论】:
-
InputAdornment发生了什么?该组件需要一个您没有传递给它的道具 -
@Amir-Mousavi: InputAdornment 是什么意思?我是 React.js 的新手。的确,也许我可以完全删除它
-
:)) 我不知道
InputAdornment是什么意思这是你在你的应用程序中使用的组件。
标签: javascript reactjs