Skip to content

Commit

Permalink
[Autocomplete][material-ui] Fix React key warning in Next.js (#39795)
Browse files Browse the repository at this point in the history
  • Loading branch information
mj12albert committed Nov 8, 2023
1 parent 1cf9517 commit 13fec2d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/mui-material/src/Autocomplete/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,14 @@ const Autocomplete = React.forwardRef(function Autocomplete(inProps, ref) {
);

const renderGroup = renderGroupProp || defaultRenderGroup;
const defaultRenderOption = (props2, option) => <li {...props2}>{getOptionLabel(option)}</li>;
const defaultRenderOption = (props2, option) => {
const { key, ...otherProps } = props2;
return (
<li key={key} {...otherProps}>
{getOptionLabel(option)}
</li>
);
};
const renderOption = renderOptionProp || defaultRenderOption;

const renderListOption = (option, index) => {
Expand Down

0 comments on commit 13fec2d

Please sign in to comment.