Autocomplete renderOption
props is missing the key
prop in its definition.
#42161
Labels
duplicate
This issue or pull request already exists
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: