P
P
partyzanx2020-11-17 00:42:04
React
partyzanx, 2020-11-17 00:42:04

Why do a in nextjs in Link?

Hello. Question for those who code in Next.js. <Link>Is it necessary to do it inside <a>? It is used with in the docks , but it is displayed normally in the markup and without And the second question, is it necessary to use the as attribute?

<Link href={'/'}><a>{post.title}</a></Link>

<a><a>

<Link href={`/post/[id]`} as={`/post/${post.id}`}>{post.title}</Link>
or can
<Link href={`/post/${post.id}`}>{post.title}</Link>
. It's just that the second option works dynamically for me, which is strange

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Shvedov, 2020-11-17
@partyzanx

Do not write a tag, but in the comments it is marked as Deprecated https://github.com/vercel/next.js/blob/feb10f45c10...
, it is better to write as in the documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question