我在使用Auto complete开发final-form时出错了
必须指定呈现支柱、呈现函数作为子函数,或者指定组件支柱到字段(自动)
我接受这个链接https://trejgun.github.io/articles/bindings-for-using-final-form-with-material-ui-autocomplete/的帮助
但是当我实现上面的代码时,我得到的是错误。
这是我的代码https://codesandbox.io/s/relaxed-breeze-hv58o
<Field
name="auto"
multiple={true}
component={AutoCompleteWrapper}
placeholder="First Name"
options={[{ label: "The Shawshank Redemption", values: 1994 }]}
/>发布于 2020-01-20 18:34:00
在您的代码框中,在test.js中,您要将AutoCompleteWrapper导出为一个命名的导出:
export const AutoCompleteWrapper = props => {但是在您的index.js文件中,您将它作为缺省值导入
import AutoCompleteWrapper from "./test";所以你可以用两种方法中的一种解决这个问题:
导入命名导出
import { AutoCompleteWrapper } from "./test";将导出更改为默认的
const AutoCompleteWrapper = props => {
...
};
export default AutoCompleteWrapper;https://stackoverflow.com/questions/59828854
复制相似问题