docs/data/material/migration/upgrade-to-v7/migrating-from-deprecated-apis.md
Features become deprecated over time as maintainers make improvements to the APIs. Migrating to these improved APIs results in a better developer experience, so it's in your best interest to stay up to date. Deprecated APIs often become breaking changes in subsequent major versions, so the sooner you migrate, the smoother the next major update will be.
Use the codemod below to migrate the code as described in the following sections:
npx @mui/codemod@latest deprecations/autocomplete-props <path>
The renderTags prop is deprecated, use renderValue instead.
<Autocomplete
multiple
options={options}
- renderTags={(value, getTagProps, ownerState) =>
- value.map((option, index) => (
- <Chip label={option.label} {...getTagProps({ index })} />
- ))
- }
+ renderValue={(value, getItemProps, ownerState) =>
+ value.map((option, index) => (
+ <Chip label={option.label} {...getItemProps({ index })} />
+ ))
+ }
/>
The following return value fields are deprecated from the useAutocomplete hook:
getTagProps → use getItemPropsfocusedTag → use focusedItem const {
- getTagProps,
+ getItemProps,
} = useAutocomplete(props);
// ...
-<Chip {...getTagProps({ index })} />
+<Chip {...getItemProps({ index })} />
const {
- focusedTag,
+ focusedItem,
} = useAutocomplete(props);