【发布时间】:2021-01-09 06:01:29
【问题描述】:
我在 React 的 Material UI 中使用了可重用的 TextField,但我在使用条件时遇到了问题。如果没有传递给它,我不需要使用InputLabelProps。
请检查下面我的可重复使用的文本字段
<TextField
fullWidth
type={prop.type}
label={prop.label}
name={prop.name}
variant="outlined"
value={prop.value}
onChange={prop.handleChange}
onBlur={prop.onBlur}
helperText={prop.helperText}
error={prop.error}
{prop.InputLabelProps ? InputLabelProps={{
shrink: prop.InputLabelProps,
}} : ''}
/>
【问题讨论】:
-
@Jayce444。伟大的!谢谢。请把它作为答案
-
好的,已添加
标签: reactjs material-ui react-hooks react-material