如何使用ReferencearRayInput和AutoCompletearRayInput解析和格式数据
我围绕反应4.13工作。当我使用解析时,我有一个问题,可以通过解析和格式转换一些数据,它也会在提取请求中更改属性,并发生错误。
<ReferenceArrayInput
source="locations"
reference="locations"
filter={{ type: LOCATION_TYPE.SITE }}
>
<AutocompleteArrayInput
optionText="name"
format={(list: Array<{ id: string }> = []) => list.map((i) => i.id)}
parse={(list: Array<string> = []) => list.map((id) => ({ id }))}
/>
</ReferenceArrayInput>
I work around react-admin 4.13. I have a problem transforming some data with parse and format when I use it to parse it also changes properties in fetch request and the error occurred.
<ReferenceArrayInput
source="locations"
reference="locations"
filter={{ type: LOCATION_TYPE.SITE }}
>
<AutocompleteArrayInput
optionText="name"
format={(list: Array<{ id: string }> = []) => list.map((i) => i.id)}
parse={(list: Array<string> = []) => list.map((id) => ({ id }))}
/>
</ReferenceArrayInput>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论