forked from vercel/next.js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add back/forward test for new router (vercel#41590)
- Loading branch information
1 parent
18c916a
commit 59f3b96
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use client' | ||
import Link from 'next/link' | ||
import { useRouter } from 'next/navigation' | ||
|
||
export default function Page({ params }) { | ||
const router = useRouter() | ||
return ( | ||
<> | ||
<h1 id={`message-${params.id}`}>Hello from {params.id}</h1> | ||
<Link | ||
href={params.id === '1' ? '/back-forward/2' : '/back-forward/1'} | ||
id="to-other-page" | ||
> | ||
Go to {params.id === '1' ? '2' : '1'} | ||
</Link> | ||
<button onClick={() => router.back()} id="back-button"> | ||
Back | ||
</button> | ||
<button onClick={() => router.forward()} id="forward-button"> | ||
Forward | ||
</button> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters