new-link codemod is doing the opposite...
Answered
neon posted this in #help-forum
neonOP
OK this is weird, but I thought the
Here is a small part of my console which shows this unexpected behavior:
https://pastebin.com/2LJVwqnY
new-link
codemod (npx @next/codemod@latest new-link .
) was supposed to remove the legacyBehavior
prop from all Links, however it's done quite the opposite, i.e. added legacyBehavior
prop to all my links...Here is a small part of my console which shows this unexpected behavior:
https://pastebin.com/2LJVwqnY
Answered by neon
apologies for the late reply, but i think the suggestion to use the new-link codemod is completely wrong. You have to update all ur links manually
3 Replies
Asiatic Lion
@neon happens to me , do you found a solution yet?
@Asiatic Lion <@816253376962625537> happens to me , do you found a solution yet?
neonOP
apologies for the late reply, but i think the suggestion to use the new-link codemod is completely wrong. You have to update all ur links manually
Answer
yep just update your code manually
<Link href="/about" legacyBehavior>
<a>About</a>
</Link>
// transforms into
<Link href="/about">
About
</Link>
<Link href="/about" legacyBehavior>
<a onClick={() => console.log('clicked')}>About</a>
</Link>
// transforms into
<Link href="/about" onClick={() => console.log('clicked')}>
About
</Link>