Skip to content
API/useNextAdapter()

useNextAdapter()

hook
src/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 { useNextAdapter } from '@qubeejs/react/next';
function useNextAdapter(options: NextAdapterOptions): RouterAdapter
Parameter Type Description
options NextAdapterOptions scroll: scroll to the top on navigation; false by default

The current pathname and query, and a navigate that goes through the App Router

'use client';
function Articles(): ReactElement {
const list = useQubeeList(articleList, useNextAdapter());
return <Link href={list.href({ page: 2 })}>2</Link>;
}

NextAdapterOptions · RouterAdapter