我正在开发一个react应用程序。我使用Material UI Autocomplete作为输入,在提示的帮助下输入地址。一切都很好,但我想自定义Autocomplete元素,使其可视化为一种页脚。
这是我的纸张组件:
const PaperComponent = ( children: any ) => (
<Card>
{children}
<div> content </div>
</Card>
)
这是我的自动完成:
<Autocomplete
style={...}
id="autocomplete"
getOptionLabel={(option: string) => option}
filterOptions={(x) => x}
options={...}
autoComplete
includeInputInList
filterSelectedOptions
value={...}
onChange={...}
onInputChange={...}
renderInput={...}
renderOption={...}
freeSolo
clearOnBlur
clearOnEscape
PaperComponent={PaperComponent} />;
以下是警告消息(在这些消息全部失效后(:
Failed prop type: Invalid prop `children` supplied to `ForwardRef(Card)`, expected a ReactNode.
Uncaught Error: Objects are not valid as a React child (found: object with keys {className, children}). If you meant to render a collection of children, use an array instead.
const PaperComponent = ({ children }) => (
<Card>
{children}
<div> content </div>
</Card>
);
你忘了道具销毁了儿童应该来自道具道具。儿童