Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
d7afe14f
Unverified
Commit
d7afe14f
authored
Dec 15, 2024
by
Jam Balaya
Committed by
GitHub
Dec 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: add tsx switcher to `linking and navigation` (#73846)
Co-authored-by:
Lee Robinson
<
me@leerob.io
>
parent
137fb7a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
04-linking-and-navigating.mdx
...your-application/01-routing/04-linking-and-navigating.mdx
+17
-1
No files found.
docs/01-app/03-building-your-application/01-routing/04-linking-and-navigating.mdx
View file @
d7afe14f
...
@@ -44,7 +44,23 @@ There are other optional props you can pass to `<Link>`. See the [API reference]
...
@@ -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
)
.
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'
'use client'
import { useRouter } from 'next/navigation'
import { useRouter } from 'next/navigation'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment