Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0.0] Form - Warning: Expected useImperativeHandle() #21694

Closed
1 task done
crudo opened this issue Feb 28, 2020 · 1 comment
Closed
1 task done

[4.0.0] Form - Warning: Expected useImperativeHandle() #21694

crudo opened this issue Feb 28, 2020 · 1 comment

Comments

@crudo
Copy link
Contributor

crudo commented Feb 28, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

Maybe related to: #21693

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Open reproduction link and look at the console.

What is expected?

no errors/warnings

What is actually happening?

See warning

Warning: Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: an object with keys {getFieldValue, getFieldsValue, getFieldError, getFieldsError, isFieldsTouched, isFieldTouched, isFieldValidating, isFieldsValidating, resetFields, setFields, setFieldsValue, validateFields, submit, getInternalHooks, __INTERNAL__, scrollToField}.
    in ForwardRef(InternalForm)
    in Unknown
    in div
Environment Info
antd 4.0.0
React 16.13.0
System MacOS 10.15.3
Browser Google Chrome 80.0.3987.122 (Official Build) (64-bit)

After you click Submit, there is another warning:

Warning: Instance created by `useForm` is not connect to any Form element. Forget to pass `form` prop?
@afc163
Copy link
Member

afc163 commented Feb 29, 2020

- <Form ref={form} layout="vertical" onFinish={handleSubmit}>
+ <Form form={form} layout="vertical" onFinish={handleSubmit}>

@zombieJ zombieJ closed this as completed Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants