Skip to content

Commit dfdfc8a

Browse files
committed
Document the q filter in useList
1 parent 6b92ea7 commit dfdfc8a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/useList.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,19 @@ const { data, total } = useList({
103103
// data will be [{ id: 1, name: 'Arnold' }] and total will be 1
104104
```
105105

106-
The filtering capabilities are very limited. For instance, there is no "greater than" or "less than" operator. You can only filter on the equality of a field.
106+
The filtering capabilities are very limited. A filter on a field is a simple string comparison. There is no "greater than" or "less than" operator. You can do a full-text filter by using the `q` filter.
107+
108+
```jsx
109+
const { data, total } = useList({
110+
data: [
111+
{ id: 1, name: 'Arnold' },
112+
{ id: 2, name: 'Sylvester' },
113+
{ id: 3, name: 'Jean-Claude' },
114+
],
115+
filter: { q: 'arno' },
116+
});
117+
// data will be [{ id: 1, name: 'Arnold' }] and total will be 1
118+
```
107119

108120
## `filterCallback`
109121

0 commit comments

Comments
 (0)