Skip to content
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

[examples] Add Next.js 13 compatible version of Link adapter #38797

Closed
wants to merge 2 commits into from

Conversation

mj12albert
Copy link
Member

@mj12albert mj12albert commented Sep 4, 2023

This PR adds the Link adapter components for Next.js to the app router example repo.

In Next.js 13 it is no longer required to manually provide <a> as a child to Next's Link (vercel/next.js#36436)

(The changes here are extracted from #38243)

@mj12albert mj12albert added the examples Relating to /examples label Sep 4, 2023
@mui-bot
Copy link

mui-bot commented Sep 4, 2023

Netlify deploy preview

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against bdbd6e6

@mj12albert mj12albert marked this pull request as ready for review September 4, 2023 10:19
@mj12albert
Copy link
Member Author

@mnajdova Do you think we should keep the previous Link adapter components and maybe rename to LegacyNextLinkComposed to support the legacyBehavior prop? (the new behavior works for both app and pages router)


The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui/material-ui/blob/-/examples/material-ui-nextjs-ts/src/Link.tsx) component.
This component is unstyled and only responsible for handling the navigation.
The prop `href` was renamed `to` to avoid a naming conflict.
Copy link
Contributor

@samuelsycamore samuelsycamore Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be preferable to cut this line or rephrase it to avoid confusion—the context for it being "renamed" is not present here, so a casual user might not know what to make of it.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Relating to /examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants