-
-
Notifications
You must be signed in to change notification settings - Fork 32k
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
[material-ui][Autocomplete] renderOption
props is missing the key
prop in its definition.
#42161
Labels
duplicate
This issue or pull request already exists
Comments
renderOption
props is missing the key
prop.renderOption
props is missing the key
prop in its definition.
Let's aggregate all of those. Closing for #39833 |
renderOption
props is missing the key
prop in its definition.renderOption
props is missing the key
prop in its definition.
Sorry for the reopening-closing mess 😅 I got confused, see: #39833 (comment) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce
Current behavior
The
props
object passed to therenderOption
of an Autocomplete is of typeReact.HTMLAttributes<HTMLLIElement>
and does not specify akey
prop. Previously we could spread the props directly on to a child list item, however in react 18.3.0 onwards (facebook/react#25697) it is now a warning that you must explicitly specify thekey
prop. eg:Because the prop is missing we have to cast the
props
object to keep typescript happy. eg:const { key, ...rest } = props as React.HTMLAttributes<HTMLLIElement> & { key: string };
Expected behavior
We should not have to cast the
props
.Context
No response
Your environment
npx @mui/envinfo
Search keywords: AutoComplete renderOption key
The text was updated successfully, but these errors were encountered: