API/readListState
readListState
src/lists/read-list-state.tsfunction
readListState()
Section titled “readListState()”readListState(list: ListDefinition<TParams, {}>, search: SearchParamsInput): ParamsState<TParams>Read a page’s query into list state.
Never throws. For each param, a key that is absent — or whose value the
param cannot read, or that a single-value param finds given twice — takes
the param’s default. A custom param whose parse throws or returns null
is treated the same way. Keys the list does not own are ignored.
readListState(articleList, '?q=react&sort=title');// { page: 1, q: 'react', status: undefined, sort: [{ field: 'title', order: SortEnum.ASC }] }| Parameter | Type | Description |
|---|---|---|
list |
ListDefinition<TParams, {}> |
The list, as defineList() returned it |
search |
SearchParamsInput |
The page’s query, in any shape a router gives it |
Returns — The list state
