next-link

๐Ÿ”— link component for next

MIT License

Downloads
555
Stars
5
Committers
1

๐Ÿ”— next link

๐Ÿ”— link component for next

Next provides a <Link> component for routing between internal pages. For external links, you have to use a regular <a> tag. This next-link package solves that issue by providing a <Link> component that handles both internal and external urls.

๐Ÿ“ฆ Installation

This package is hosted on npm.

npm install @bradgarropy/next-link

๐Ÿฅ‘ Usage

For both internal and external links, use the Link component and pass it a to prop.

import Link from "@bradgarropy/next-link"

const App = () => {
    return <Link to="https://bradgarropy.com">website</Link>
}

๐Ÿ“– API Reference

<Link>

Name Required Default Example Description
to true "/home" "https://bradgarropy.com" Internal or external url.

The component also passes through all other props, like className or passHref. See the next/link documentation for other relevant props. The examples below cover some common uses.

// internal link
<Link to="/home">home</Link>

// internal link with additional props
<Link to="/home" className="nav-link">home</Link>

// external link
<Link to="https://bradgarropy.com">website</Link>

// external link with additional props
<Link to="https://bradgarropy.com" className="nav-link">website</Link>

โ” Questions

๐Ÿ› report bugs by filing issues ๐Ÿ“ข provide feedback with issues or on twitter ๐Ÿ™‹๐Ÿผโ€โ™‚๏ธ use my ama or twitter to ask any other questions

โœจ contributors