> Before moving forward, we recommend you to read [Routing Introduction](/docs/routing/introduction.md) first.
Client-side transitions between routes can be enabled via the `Link` component exported by `next/link`.
An example of linking to `/` and `/about`:
```jsx
import Link from 'next/link'
function Home() {
return (
)
}
export default Home
```
`Link` accepts the following props:
- `href` - The path inside `pages` directory. This is the only required prop
- `as` - The path that will be rendered in the browser URL bar. Used for dynamic routes
- [`passHref`](#forcing-Link-to-expose-href-to-its-child) - Forces `Link` to send the `href` property to its child. Defaults to `false`
- `prefetch` - Prefetch the page in the background. Defaults to `true`
- [`replace`](#replace-the-url-instead-of-push) - Replace the current `history` state instead of adding a new url into the stack. Defaults to `false`
- [`scroll`](#disable-scrolling-to-the-top-of-the-page) - Scroll to the top of the page after a navigation. Defaults to `true`
## Dynamic routes
A `Link` to a dynamic route is a combination of the `href` and `as` props. A link to the page `pages/post/[pid].js` will look like this:
```jsx
First Post
```
`href` is a file system path used by the page and it shouldn't change at runtime. `as` on the other hand, will be dynamic most of the time according to your needs. Here's an example of how to create a list of links:
```jsx
const pids = ['id1', 'id2', 'id3']
{
pids.map(pid => (
Post {pid}
))
}
```
## Example with `React.forwardRef`
If the child component in `Link` is a function component, you'll need to wrap it in [`React.forwardRef`](https://reactjs.org/docs/react-api.html#reactforwardref) like in the following example:
```jsx
import React from 'react'
import Link from 'next/link'
// `onClick`, `href`, and `ref` need to be passed to the DOM element
// for proper handling
const MyButton = React.forwardRef(({ onClick, href }, ref) => {
return (
Click Me
)
})
function Home() {
return (
)
}
export default Home
```
## With URL Object
`Link` can also receive an URL object and it will automatically format it to create the URL string. Here's how to do it:
```jsx
import Link from 'next/link'
function Home() {
return (