API/useNextAdapter()
useNextAdapter()
hooksrc/hooks/use-next-adapter.ts1 parameter
The Next.js App Router as a RouterAdapter: its location in, its push and replace
out.
Call it in a Client Component. Pass the result to useQubeeList for one list, or render
NextAdapter in a layout and every list below finds it. It reads useSearchParams, so
on a statically rendered route the component that calls it needs a <Suspense> boundary above
it, as Next.js requires.
Import
Section titled “Import”import { useNextAdapter } from '@qubeejs/react/next';Signature
Section titled “Signature”function useNextAdapter(options: NextAdapterOptions): RouterAdapterParameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options |
NextAdapterOptions |
scroll: scroll to the top on navigation; false by default |
Returns
Section titled “Returns”The current pathname and query, and a navigate that goes through the App Router
Example
Section titled “Example”'use client';
function Articles(): ReactElement { const list = useQubeeList(articleList, useNextAdapter());
return <Link href={list.href({ page: 2 })}>2</Link>;}