+1
docs/basics/README.md
+1
docs/basics/README.md
···- [**Document Caching**](./document-caching.md) explains the default cache mechanism of `urql`, as opposed to the opt-in
+201
docs/basics/ui-patterns.md
+201
docs/basics/ui-patterns.md
···+> This page is incomplete. You can help us expanding it by suggesting more patterns or asking us about common problems you're facing on [GitHub Discussions](https://github.com/FormidableLabs/urql/discussions).+Generally, `urql`'s API surface is small and compact. Some common problems that we're facing when building apps may look like they're not a built-in feature, however, there are several patterns that even a lean UI can support.+This page is a collection of common UI patterns and problems we may face with GraphQL and how we can tackle them in+"Infinite Scrolling" is the approach of loading more data into a page's list without splitting that list up across multiple pages.+There are a few ways of going about this. In our [normalized caching chapter on the topic](../graphcache/local-resolvers.md#pagination)+we see an approach with `urql`'s normalized cache, which is suitable to get started quickly. However, this approach also requires some UI code as well to keep track of pages.+Let's have a look at how we can create a UI implementation that makes use of this normalized caching feature.+list that constantly changes. [You can find a full code example of this pattern in our example folder on the topic of Graphcache pagination.](https://github.com/FormidableLabs/urql/tree/main/examples/with-graphcache-pagination)+We also do not need to use our normalized cache to achieve this. As long as we're able to split individual lists up into chunks across components, we can also solve this problem entirely in UI code. [Read our example code on how to achieve this.](https://github.com/FormidableLabs/urql/tree/main/examples/with-pagination)+We sometimes find it necessary to load data for a new page before that page is opened, for instance while a JS bundle is still loading. We may+do this with help of the `Client`, by calling methods without using the React bindings directly.+We then call `toPromise()` on this query which activates it. Our `Client` and its cache share results, which means that we've already kicked off or even completed the query before we're on the new page.+It's often required to "lazily" start a query, either at a later point or imperatively. This means that we don't start a query when a new component is mounted immediately.+Parts of `urql` that automatically start, like the `useQuery` hook, have a concept of a [`pause` option.](./react-preact.md#pausing-usequery) This option is used to prevent the hook from automatically starting a new query.+We can unpause the hook to start fetching, or, like in this example, call its returned function to manually kick off the query.+When we want to introduce one of these patterns we add the package and add it to the `exchanges`