-
Notifications
You must be signed in to change notification settings - Fork 108
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
Warning: A props object containing a "key" prop is being spread into JSX: #600
Comments
You can remove the warning by explicitly setting the key like this: <input {...getInputProps(fields.id, { type: 'hidden' })} key={fields.id.key} /> The react team seems to against spreading an object with key on the element and likely adding this warning to react 18.3 as well 😅 There is nothing I can really do because the whole point of spreading an object is to minimise the need to setting each property yourself. If they want you to be explicit, then we have to be explicit... |
Would it be sensible to omit the key from getInputProps then? |
I would say no. Although the key is needed only for some features, it is better to have it set then realize it wasn't working later 😅 Maybe consider creating your own Input component so you don't need to repeat this manually. |
Fair enough! I was worried that this might eventually cause issues with React (otherwise, why would they warn about it?), and that console errors might trip people up. |
Describe the bug and the expected behavior
I am getting a console error in Next when using conforms
getInputProps
.Conform version
1.1.2
Steps to Reproduce the Bug or Issue
I get the error message
What browsers are you seeing the problem on?
No response
Screenshots or Videos
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: