You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[React-Router based pagination](#react-router-based-pagination)
@@ -23,17 +23,17 @@ First, you have to install the package:
23
23
npm install @aboutbits/react-pagination
24
24
```
25
25
26
-
Second, you can make use of the `useSearchAndPagination` hook. This package implements 3 versions of this hook:
26
+
Second, you can make use of the `useQueryAndPagination` hook. This package implements 3 versions of this hook:
27
27
28
28
-[In Memory](#in-memory-pagination): Use this hook where you don't want to modify browser history. e.g. Dialogs
29
29
-[React Router](#react-router-based-pagination): Use this hook if you want to keep track of the state in the URL and
30
30
your project is using React Router.
31
31
-[NextJS Router](#nextjs-router-based-pagination): Use this hook if you want to keep track of the state in the URL and
32
32
your project is using NextJS.
33
33
34
-
### useSearchAndPagination
34
+
### useQueryAndPagination
35
35
36
-
This hook supports the combination of a search value and pagination and manages the state of the search value, and the
36
+
This hook supports the combination of query parameters and pagination and manages the state of the query parameter values and the
37
37
pagination values.
38
38
39
39
#### The hook supports following configuration parameter object:
@@ -42,39 +42,40 @@ pagination values.
42
42
|---|---|---|---|
43
43
|indexType|IndexType|IndexType.ZERO_BASED|It defines whether the pagination is zero or one based.|
44
44
|pageSize|number|15|Page size of the pagination.|
45
+
|defaultQueryParameters/Record<string, string>|{}|It defines the default value for each query parameter. This is used to remove a query parameter from the URL and also to clear the query.
45
46
46
47
#### The hook returns the following object:
47
48
48
49
|value|type|description|
49
50
|---|---|---|
50
-
|search|string|value of your search parameter|
51
+
|queryParameters|object|values of your query parameters|
51
52
|page|number|value of the current page|
52
53
|size|number|max elements in a single page|
53
-
|actions|object|object with 3 functions: search, setPage, clear|
54
+
|actions|object|object with 3 functions: updateQuery, setPage, clear|
0 commit comments