A space to discuss and keep up software development and manage your software career
An inclusive community for gaming enthusiasts
News and discussion of science and technology such as AI, VR, cryptocurrency, quantum computing, and more.
From composing and gigging to gear, hot music takes, and everything in between.
Memes and software development shitposting
Movie and TV enthusiasm, criticism and everything in-between.
Discussing AI software development, and showing off what we're building.
Web design, graphic design and everything in-between
A community for makers, hobbyists, and professionals to discuss Arduino, Raspberry Pi, 3D printing, and much more.
For engineers building software at scale. We discuss architecture, cloud-native, and SRE—the hard-won lessons you can't just Google
Discussing the core forem open source software project — features, bugs, performance, self-hosting.
A collaborative community for all things Crypto—from Bitcoin to protocol development and DeFi to NFTs and market analysis.
You can change the material ui button component to be represented with a different html element, so button could be represented with a div element.
div
Sure. I found this working for me and wanted to share it with anyone who'd think it's useful. In link.js:
link.js
import NextLink from "next/link"; import MuiLink from "@mui/material/Link"; import MuiButton from "@mui/material/Button"; export default function Link({ type, href, children, ...props }) { if (type === "link" || !type) { return ( <NextLink href={href} passHref> <MuiLink {...props}>{children}</MuiLink> </NextLink> ); } else if (type === "button") { return ( <NextLink href={href} passHref> <MuiButton {...props}>{children}</MuiButton> </NextLink> ); } }
Then you can just use it as a utility components just like you would with Next and MUI's buttons:
import Link from "../path/to/link"; // Later... <Link type="button" href="/somewhere">Yay!</Link>
super!!!
I tried this but was not able to get it to work.
I added a links.js file and added your code.
then this import Link from "../path/to/link"; // Later... Yay!
but it doesn't work, I get the following error.
Any help please?!
Could you show a bit more code? Did you adjust the code to actually fit your project? Did you paste the correct code into your link component?
Thank you! Looks like I got it to work. I needed to install the mui library.
I just need to add styling b/c it just shows up as texts instead of a button.
Great, glad it worked out!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can change the material ui button component to be represented with a different html element, so button could be represented with a
div
element.Sure. I found this working for me and wanted to share it with anyone who'd think it's useful. In
link.js
:Then you can just use it as a utility components just like you would with Next and MUI's buttons:
super!!!
I tried this but was not able to get it to work.
I added a links.js file and added your code.
then this
import Link from "../path/to/link";
// Later...
Yay!
but it doesn't work, I get the following error.
Any help please?!
Could you show a bit more code? Did you adjust the code to actually fit your project? Did you paste the correct code into your link component?
Thank you! Looks like I got it to work. I needed to install the mui library.
I just need to add styling b/c it just shows up as texts instead of a button.
Great, glad it worked out!