You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dark-mode/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,6 @@ The Themed component is used to conditionally render two components depending on
22
22
23
23
## Related Links
24
24
25
-
-[Creating cookie sessions in the Remix docs](https://remix.run/docs/en/v1/api/remix#createcookiesessionstorage)
26
-
-[useFetcher in the Remix docs](https://remix.run/docs/en/v1/api/remix#usefetcher) (used to tell the server to update the cookie value when the theme changes)
27
-
-[Blog post with complete explanation of each part of the code](https://www.mattstobbs.com/remix-dark-mode/)
25
+
-[Creating cookie sessions in the Remix docs](https://remix.run/utils/sessions#createcookiesessionstorage)
26
+
-[useFetcher in the Remix docs](https://remix.run/hooks/use-fetcher) (used to tell the server to update the cookie value when the theme changes)
27
+
-[Blog post with complete explanation of each part of the code](https://www.mattstobbs.com/remix-dark-mode)
Copy file name to clipboardExpand all lines: dataloader/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
This example shows how to avoid redundant roundtrips to data sources via batching and caching, implemented with [DataLoader](https://github.com/graphql/dataloader). This comes in handy when there are multiple nested routes that depend on the same data source.
4
4
5
-
Note that in many cases, you can meet the same requirement with Remix's own [useMatches](https://remix.run/docs/en/v1/api/remix#usematches) which lets you use all of your parent-routes' data in child routes. If that suits your use case, using `useMatches` is preferable. There are cases where this might not be the best fit though, including:
5
+
Note that in many cases, you can meet the same requirement with Remix's own [useMatches](https://remix.run/hooks/use-matches) which lets you use all of your parent-routes' data in child routes. If that suits your use case, using `useMatches` is preferable. There are cases where this might not be the best fit though, including:
6
6
7
7
- You can't be sure if a parent did already request a particular piece of data
8
8
- You don't want your data loading to be tightly coupled with your parent routes, for architectural reasons
@@ -17,10 +17,10 @@ Open this example on [CodeSandbox](https://codesandbox.com):
17
17
18
18
`app/data.server.ts` implements the `db` object which mimics an ORM in the style of [Prisma](https://www.prisma.io/). The method `db.user#findMany` logs _user#findMany_ to the console, for demo purposes.
19
19
20
-
There's exactly one DataLoader factory `createUsersByIdLoader`, implemented in `app/loaders/userLoader.ts`. It's put on context of [createRequestHandler](https://remix.run/docs/en/v1/other-api/adapter#createrequesthandler) in `server/index.ts` as `usersById` which is made available to all Remix-loaders and -actions. Both the loaders of `app/routes/users.tsx` and `app/routes/users/index.tsx` make calls to this loader. When inspecting the server logs while refreshing the page, you'll notice that there's only one log _user#findMany_ per request, proving that with this implementation, there's only one rountrip to the database.
20
+
There's exactly one DataLoader factory `createUsersByIdLoader`, implemented in `app/loaders/userLoader.ts`. It's put on context of [createRequestHandler](https://remix.run/other-api/adapter#createrequesthandler) in `server/index.ts` as `usersById` which is made available to all Remix-loaders and -actions. Both the loaders of `app/routes/users.tsx` and `app/routes/users/index.tsx` make calls to this loader. When inspecting the server logs while refreshing the page, you'll notice that there's only one log _user#findMany_ per request, proving that with this implementation, there's only one rountrip to the database.
0 commit comments