Skip to content

Commit 5ba28b4

Browse files
update React README
1 parent 65a0ea3 commit 5ba28b4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/react/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,12 @@ function MyWidget() {
343343
// Note that isFetching is set (by default) whenever the query is being fetched/checked.
344344
// This will result in `MyWidget` re-rendering for any change to the `cats` table.
345345
const { data, isLoading, isFetching } = useQuery(`SELECT * FROM cats WHERE breed = 'tabby'`, [], {
346-
processor: WatchedQueryProcessor.COMPARISON // TODO
346+
processor: {
347+
mode: 'comparison',
348+
comparator: new ArrayComparator({
349+
compareBy: (cat) => JSON.stringify(cat)
350+
})
351+
},
347352
})
348353

349354
// ... Widget code
@@ -368,7 +373,12 @@ function MyWidget() {
368373
// When reportFetching == false the object returned from useQuery will only be changed when the data, isLoading or error state changes.
369374
// This method performs a comparison in memory in order to determine changes.
370375
const { data, isLoading, isFetching } = useQuery(`SELECT * FROM cats WHERE breed = 'tabby'`, [], {
371-
processor: WatchedQueryProcessor.COMPARISON // TODO
376+
processor: {
377+
mode: 'comparison',
378+
comparator: new ArrayComparator({
379+
compareBy: (cat) => JSON.stringify(cat)
380+
})
381+
},
372382
reportFetching: false
373383
})
374384

0 commit comments

Comments
 (0)