Skip to content
API/useMemoryAdapter()

useMemoryAdapter()

hook
src/hooks/use-memory-adapter.ts1 parameter

A RouterAdapter that keeps a list’s query in memory instead of the URL — for a list in a dialog, a picker, or anywhere the page URL must not change.

The state belongs to the calling component and is gone when it unmounts. There is no history: replace makes no difference and there is no Back. To share one state between several components, wrap them in MemoryAdapter instead.

import { useMemoryAdapter } from '@qubeejs/react';
function useMemoryAdapter(initialSearch?: SearchParamsInput): RouterAdapter
Parameter Type Description
initialSearch SearchParamsInput The query the list starts from, read on the first render only

An adapter whose location lives in the component

function TagPicker(): ReactElement {
const tags = useQubeeList(tagList, useMemoryAdapter());
return <button onClick={() => tags.setPage(tags.state.page + 1)}>More</button>;
}

RouterAdapter