Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions step02_linking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ We will use [useRouter() Hook](https://beta.nextjs.org/docs/api-reference/use-ro

We should use the <Link> component for navigation unless you have a specific requirement for using useRouter.

## Steps to follow
Notice, in our app/page.tsx, we are using `<Link href="/name">Go to name page</Link>` to go to `name/page.tsx` and in app/name/page.tsx we are importing useRouter by `import { useRouter } from 'next/navigation'` then using useRouter hook to go to name/page/address/page.tsx. Also, dont forget to add `'use client'` on top of the file
```
const router = useRouter();
return (
<div>
My name is Zia.
<br/>
<button type="button" onClick={() => router.push('/name/address')}>
Get Address
</button>

</div>
```

Start the Server:

Expand Down