question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conflict with NextJS Link Component as Prop

See original GitHub issue

As of next@9 nextjs Link also accepts as prop for dynamic routing so it breaks dynamic routed links, I am happy to submit PR fix for chakra-ui but will it be possible for chakra-ui’s Link component as prop to be renamed to something else?

Reference

https://github.com/zeit/next.js#dynamic-routing

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

34reactions
segunadebayocommented, Oct 1, 2019

Hi @harshzalavadiya,

How about you try this

import NextLink from "@next/link"
import { Link } from "@chakra-ui/core"

 <NextLink href="/post/[pid]" as={`/post/${pid}`}>
      <Link>Post {pid}</Link>
 </NextLink>

Since nextjs link is a default export, you can rename it to NextLink so there’s no conflict. Changing Chakra’s Link component name will cause some breaking change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conflict between two React when I'm using component from ...
I'm currently building an external library to store all my common components, but when i'm using a NextJs component I got this error:....
Read more >
incompatible-href-as - Next.js
The as value is incompatible when the path doesn't provide only the expected parameters for the dynamic route.
Read more >
Introduction to Next.js Link component with examples | refine
The Next.js Link component requires a single mandatory prop: href . href specifies the path or URL to navigate to. This could be...
Read more >
Dealing with links in Next.js - LogRocket Blog
My first technique is wrapping the Link component. Every routing library has a similar component; it is used instead of the <a> tag....
Read more >
Advanced Linking with the Next-Link - Topcoder
The default behavior of the Link component is to push a new URL into the history stack of the props. You can use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found