[Ant Design] Warning: Instance created by `useForm` is not connected to any Form element. Forget to
Posted whosmeya
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Ant Design] Warning: Instance created by `useForm` is not connected to any Form element. Forget to 相关的知识,希望对你有一定的参考价值。
问题描述
antd: 4.2.0, react: 16.13.1
Modal 中使用 Form ,使用 React Hooks const [form] = Form.useForm();
创建实例时,会出现以下警告。
原因
Modal 挂载的 html 节点默认为 document.body,页面初始化时,在当前模块下找不到 Form 表单。
解决方案
Modal 添加属性 getContainer={false} ,挂载在当前 dom。
以上是关于[Ant Design] Warning: Instance created by `useForm` is not connected to any Form element. Forget to 的主要内容,如果未能解决你的问题,请参考以下文章
[Ant Design] Warning: Instance created by `useForm` is not connected to any Form element. Forget to
解决vue(antdv)报错: Warning: [antd: LocaleProvider] `LocaleProvider` is deprecated.