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

[link] What's the recommended way of using MUI Link with Next.js Link? #30858

Open
KKS1 opened this issue Jan 31, 2022 · 1 comment
Open

[link] What's the recommended way of using MUI Link with Next.js Link? #30858

KKS1 opened this issue Jan 31, 2022 · 1 comment
Labels
component: link This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation nextjs

Comments

@KKS1
Copy link

KKS1 commented Jan 31, 2022

Current behavior 😯

Currently the way its suggested to integrate MUI Link to NextJS Link component is use the example in
https://github.com/mui-org/material-ui/blob/ec5df5f94f472628103eb1cfbecccc6afc2658bd/examples/nextjs-with-typescript/src/Link.tsx

Expected behavior 🤔

https://stackoverflow.com/a/66228870
This basically, gives the same functionality, without the overhead.

import NextLink from 'next/link'
import MuiLink from '@material-ui/core';

<NextLink href="/" passHref>
    <MuiLink>MyLink</MuiLink>
</NextLink>

Steps to reproduce 🕹

https://stackoverflow.com/a/66228870
vs
https://github.com/mui-org/material-ui/blob/ec5df5f94f472628103eb1cfbecccc6afc2658bd/examples/nextjs-with-typescript/src/Link.tsx

Context 🔦

What's the recommended way of using Mui Link with NextJs Link.

Your environment 🌎

`npx @mui/envinfo` .. ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```
@KKS1 KKS1 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 31, 2022
@danilo-leal danilo-leal changed the title Mui Next Js Link Component [Link] What's the recommended way of using MUI Link with Next.js Link? Feb 1, 2022
@danilo-leal danilo-leal added component: link This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 1, 2022
@Zirafnik
Copy link

Is there an update on this?

Is there a reason to prefer the example boilerplate code in Link.tsx, over:

  • above mentioned option
<NextLink href="/" passHref>
    <MUILink>Your Link</MUILink>
</NextLink>

Next.js docs on passHref

@oliviertassinari oliviertassinari added docs Improvements or additions to the documentation and removed support: question Community support but can be turned into an improvement labels Jul 23, 2023
@oliviertassinari oliviertassinari changed the title [Link] What's the recommended way of using MUI Link with Next.js Link? [link] What's the recommended way of using MUI Link with Next.js Link? Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: link This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation nextjs
Projects
None yet
Development

No branches or pull requests

5 participants