|
|
|
|
|
by tuukkah
1155 days ago
|
|
This is the documentation I could find although it's not for 13 but Beta: https://beta.nextjs.org/docs/data-fetching/caching They say there's a new `cache` function in React and they have patched `fetch` to use it by default (for GET requests). Does this include a solution to the N+1 queries issue (container element requests a list of items, then item elements each request their details)? I see you can do pre-fetching, perhaps those can be batched. EDIT: Found an example that uses DataLoader by "caching the cache". The src/api.ts module exports a cached DataLoader for characters, and src/components/CharacterAvatar.tsx imports and calls it during render simply like this: const character = await characters().load(id);
https://github.com/AndrewIngram/next-rick-morty |
|