Unverified Commit d7afe14f authored by Jam Balaya's avatar Jam Balaya Committed by GitHub

docs: add tsx switcher to `linking and navigation` (#73846)

Co-authored-by: 's avatarLee Robinson <me@leerob.io>
parent 137fb7a9
......@@ -44,7 +44,23 @@ There are other optional props you can pass to `<Link>`. See the [API reference]
The `useRouter` hook allows you to programmatically change routes from [Client Components](/docs/app/building-your-application/rendering/client-components).
```jsx filename="app/page.js"
```tsx filename="app/page.tsx" switcher
'use client'
import { useRouter } from 'next/navigation'
export default function Page() {
const router = useRouter()
return (
<button type="button" onClick={() => router.push('/dashboard')}>
Dashboard
</button>
)
}
```
```jsx filename="app/page.js" switcher
'use client'
import { useRouter } from 'next/navigation'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment