next.js/test/e2e/app-dir/navigation/app/use-router/same-page/page.js
page.js23 lines717 B
import { connection } from 'next/server'
import { NavigateAndTrackRouterIdentity } from '../navigate'

export default async function Page({ searchParams }) {
  // the page should be dynamic so that `router.push()` to the current path actually does a request + navigates.
  await connection()
  const { count: countStr = '0' } = await searchParams
  const count = Number.parseInt(countStr)
  return (
    <>
      {/* add a changing element to know that we actually navigated */}
      <div id="count-from-server">{count}</div>
      <NavigateAndTrackRouterIdentity
        href={
          '/use-router/same-page' +
          '?' +
          new URLSearchParams({ count: count + 1 })
        }
      />
    </>
  )
}
Quest for Codev2.0.0
/
SIGN IN