mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
35 lines
690 B
TypeScript
35 lines
690 B
TypeScript
'use client'
|
|
|
|
import { Suspense, use } from 'react'
|
|
|
|
function Content({
|
|
searchParams,
|
|
}: {
|
|
searchParams: Promise<Record<string, string | string[] | undefined>>
|
|
}) {
|
|
const searchParamsDict = use(searchParams)
|
|
|
|
let query = null
|
|
if (Object.keys(searchParamsDict).length > 0) {
|
|
query = JSON.stringify(searchParamsDict)
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<p id="query">Query: {query ? query : '(none)'}</p>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default function ClientPageWithSearchParam({
|
|
searchParams,
|
|
}: {
|
|
searchParams: Promise<Record<string, string | string[] | undefined>>
|
|
}) {
|
|
return (
|
|
<Suspense fallback="Loading...">
|
|
<Content searchParams={searchParams} />
|
|
</Suspense>
|
|
)
|
|
}
|