Environment
- react-advanaced-form: 1.7.2
What
When running a create-react-app with React.StrictMode (the default for React 17) an Uncaught Invariant Viloation error is thrown for all form fields.
Current behavior
An error is thrown for the first form field and the field does not function.
Example:
Uncaught Invariant Violation: Cannot register field `userEmail`,
the field with the provided name is already registered.
Make sure the fields on the same level of `Form` or `Field.Group` have unique names.
Expected behavior
No error would be thrown and the field would function as expected.
Why
I think it is because strict mode renders components twice to detect code issues as mentioned here
How
Steps to reproduce the issue (ideally, link to the repository/sandbox).
Here is a Sandbox of the error.
Environment
What
When running a create-react-app with React.StrictMode (the default for React 17) an
Uncaught Invariant Viloationerror is thrown for all form fields.Current behavior
An error is thrown for the first form field and the field does not function.
Example:
Expected behavior
No error would be thrown and the field would function as expected.
Why
I think it is because strict mode renders components twice to detect code issues as mentioned here
How
Steps to reproduce the issue (ideally, link to the repository/sandbox).
Here is a Sandbox of the error.