Files
next-learn/basics/snippets/link-classname-example.js
2021-09-09 09:06:21 -05:00

18 lines
463 B
JavaScript

// Example: Adding className with <Link>
import Link from 'next/link'
export default function LinkClassnameExample() {
// To add attributes like className, target, rel, etc.
// add them to the <a> tag, not to the <Link> tag.
return (
<Link href="/">
<a className="foo" target="_blank" rel="noopener noreferrer">
Hello World
</a>
</Link>
)
}
// Take a look at https://nextjs.org/docs/api-reference/next/link
// to learn more!