-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[material-ui][docs] Add deprecations migration guide (#40767)
- Loading branch information
1 parent
b813ffc
commit b3298b8
Showing
7 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...rial/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Migrating from deprecated APIs | ||
|
||
<p class="description">Learn how to migrate away from recently deprecated APIs before they become breaking changes.</p> | ||
|
||
## Why you should migrate | ||
|
||
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. | ||
|
||
## Migrating | ||
|
||
Material UI provides the `deprecations/all` codemod to help you stay up to date with minimal effort. | ||
|
||
```bash | ||
npx @mui/codemod@latest deprecations/all <path> | ||
``` | ||
|
||
This command runs all the current [deprecations codemods](https://github.com/mui/material-ui/tree/master/packages/mui-codemod#deprecations), automatically migrating to the updated API. | ||
You can run this codemod as often as necessary to keep up with the latest changes. | ||
|
||
:::info | ||
|
||
If you need to manually migrate from a deprecated API, you can find examples below for all deprecations that have been added in Material UI v5. | ||
If you need to run a specific codemod, those are also linked below. | ||
|
||
::: | ||
|
||
## Accordion | ||
|
||
### TransitionComponent | ||
|
||
The Accordion's `TransitionComponent` was deprecated in favor of `slots.transition` ([Codemod](https://github.com/mui/material-ui/tree/master/packages/mui-codemod#accordion-props)): | ||
|
||
```diff | ||
<Accordion | ||
- TransitionComponent={CustomTransition} | ||
+ slots={{ transition: CustomTransition }} | ||
/> | ||
``` | ||
|
||
### TransitionProps | ||
|
||
The Accordion's `TransitionProps` was deprecated in favor of `slotProps.transition` ([Codemod](https://github.com/mui/material-ui/tree/master/packages/mui-codemod#accordion-props)): | ||
|
||
```diff | ||
<Accordion | ||
- TransitionProps={{ unmountOnExit: true }} | ||
+ slotProps={{ transition: { unmountOnExit: true } }} | ||
/> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
docs/pages/material-ui/migration/migrating-from-deprecated-APIs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as React from 'react'; | ||
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; | ||
import * as pageProps from 'docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md?@mui/markdown'; | ||
|
||
export default function Page() { | ||
return <MarkdownDocs {...pageProps} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters