API/useMemoryAdapter()
useMemoryAdapter()
hooksrc/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
Section titled “Import”import { useMemoryAdapter } from '@qubeejs/react';Signature
Section titled “Signature”function useMemoryAdapter(initialSearch?: SearchParamsInput): RouterAdapterParameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
initialSearch |
SearchParamsInput |
The query the list starts from, read on the first render only |
Returns
Section titled “Returns”An adapter whose location lives in the component
Example
Section titled “Example”function TagPicker(): ReactElement { const tags = useQubeeList(tagList, useMemoryAdapter());
return <button onClick={() => tags.setPage(tags.state.page + 1)}>More</button>;}