Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Luis-Enrique1/667d6d0b492a24fb6ba6808f143c7bac to your computer and use it in GitHub Desktop.
Save Luis-Enrique1/667d6d0b492a24fb6ba6808f143c7bac to your computer and use it in GitHub Desktop.
Using Material-UI Button with Next.js Link
import React from 'react'
import Link from 'next/link'
import Button from '@material-ui/core/Button'
const ButtonLink = ({ className, href, hrefAs, children, prefetch }) => (
<Link href={href} as={hrefAs} prefetch>
<a className={className}>
{children}
</a>
</Link>
)
// https://material-ui.com/demos/buttons/#third-party-routing-library
const RenderButton = () => <Button component={ButtonLink} href={'/foo'}>bar</Button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment