【问题标题】:FormDataConsumer used with ReferenceArrayInput is not working in react-admin与 ReferenceArrayInput 一起使用的 FormDataConsumer 在 react-admin 中不起作用
【发布时间】:2019-08-30 05:57:24
【问题描述】:

我想使用 FormDataConsumer 来获取一个依赖于另一个数组的数组:

                <ReferenceInput label="Tipus" source="type" reference="categories" validate={ required() } >
                    <AutocompleteInput optionText="name" />
                </ReferenceInput>
                <FormDataConsumer>
                    {({formData, ...rest}) => {
                        console.log(formData)
                        <ReferenceArrayInput source={formData.type} reference="categories" {...rest}>
                            <SelectArrayInput optionText="subcategories.name" />
                        </ReferenceArrayInput>
                    }}
                </FormDataConsumer>

这给了我一个语法错误,我真的不明白为什么。

我做错了什么?

【问题讨论】:

    标签: reactjs jsx react-admin


    【解决方案1】:

    试试这个:return (&lt;ReferenceArrayInput source={formData.type} ... )

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-20
      • 2019-06-01
      • 1970-01-01
      • 2020-11-19
      • 2020-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多