-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(DOCSP-28276) Add argument to
useQuery
to allow result to be filter…
…ed and sorted (#3063) ## Pull Request Info This PR updates the syntax for `useQuery()` when it's used with `.filtered()` and `.sorted()`. Essentially, going from this: ```JS const contactsInArea = contacts.filtered(`address.postalCode == '${postalCode}'`); ``` to this: ```JS const contactsInArea = useQuery( Contact, contacts => { return contacts.filtered(`address.postalCode == '${postalCode}'`); }, [postalCode], ); ``` The new syntax has baked-in performance improvements and is the recommended way to handle filtering and sorted. We should avoid `useQuery(<ObjectClass>).sorted()` or `useQuery(<ObjectClass>).filtered()`. ### Jira - https://jira.mongodb.org/browse/DOCSP-28276 ### Staged Changes - [Code samples throughout the React Native SDK docs](https://preview-mongodbkrollinsmdb.gatsbyjs.io/realm/DOCSP-28276/sdk/react-native/) ### Review Guidelines [REVIEWING.md](https://github.com/mongodb/docs-realm/blob/master/REVIEWING.md) ### Animal Wearing a Hat <img src="https://images.unsplash.com/photo-1575425187336-d5ec5d0a1451?auto=format&fit=crop&q=80&w=1000&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8N3x8ZG9nJTIwaGF0fGVufDB8fDB8fHww" width=400>
- Loading branch information
1 parent
4b0f02f
commit 4cc6ba7
Showing
66 changed files
with
709 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.