Skip to content

Link (theme-ui) vs Link (Next.js) #1757

Answered by hasparus
tarikmiljkovic asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @tarikmiljkovic! They're actually 100% compatible, modulo the name, as Next's Link does not concern itself with presentation, while our Link doesn't have any routing logic.

It should look more or less like the following:

import RoutingLink from 'next/link';
import { Link as PrettyLink } from '@theme-ui/components';

const _ = (
  <RoutingLink href="/somewhere">
    <PrettyLink>Go somewhere</PrettyLink>
  </RoutingLink>
)

Of course, you can build your own Link component using these two, passing navigation props onto Next's Link and spreading everything else onto Theme UI's Link.

The API above is possible, because Next's link doesn't render any anchor tags on its own, instead it uses Re…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lachlanjc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants