Skip to content

Commit f54a4c1

Browse files
committed
docs: typos
1 parent e81e750 commit f54a4c1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/guides/data-libs.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ The examples here were adapted from [TkDodo's blog][tkdodo], thank you for the g
1717

1818
## Loading Data
1919

20-
Loaders can use your data abstraction inside of loaders. Note that this loading happens outside of the React render lifecycle, so you can't use hooks like React Query's `useQuery`, you'll need to use the query client's methods directly.
20+
Instead of loading data in components, you use your data abstractions inside of loaders. Note that this loading happens outside of the React render lifecycle, so you can't use hooks like React Query's `useQuery`, you'll need to use the query client's methods directly.
2121

22-
```jsx
22+
```jsx lines=[4]
2323
import { queryClient } from "./query-client";
2424

2525
export const loader = ({ params }) => {
@@ -31,7 +31,7 @@ export const loader = ({ params }) => {
3131

3232
If the query client throws errors correctly, then React Router's [`errorElement`][errorelement] will work the same.
3333

34-
Of course, you can use all of the features of the data library, like caching, so ensure when the user clicks the back button to a page you've already seen, the data is loaded from the cache immediately.
34+
Of course, you can use all of the features of the data library, like caching. Caching your data ensures that when the user clicks the back button to a page you've already seen, the data is loaded from the cache immediately. Sometimes caching is the right choice, sometimes you always want it fresh, but that's not a decision within the scope of React Router's data APIs.
3535

3636
React Router only retains the _current page's loaderData_. If users click "back", all loaders are called again. Without a data caching library like React Query (or HTTP cache headers on your JSON API to use the browser's own HTTP cache), your app will refetch all of the data again.
3737

@@ -54,7 +54,7 @@ Because most of these library's have some mechanism for caching, you'll need to
5454

5555
The perfect place to invalidate those caches is in a React Router [action][action].
5656

57-
```jsx lines=[5]
57+
```jsx lines=[7]
5858
import { queryClient } from "./query-client";
5959

6060
export const action = async ({ request, params }) => {

0 commit comments

Comments
 (0)