react-data-fetching icon indicating copy to clipboard operation
react-data-fetching copied to clipboard

Question about 3-ssr/3-1-nextjs-ssr/src/pages/posts

Open Vesper0704 opened this issue 2 weeks ago • 0 comments

Hi. Thanks for your great work and sharing. I've got a question about this part, in apps/3-ssr/3-1-nextjs-ssr/src/pages/posts/[id].tsx

// Snapshot the previous value
const previousComments = queryClient.getQueryData([
      "comments",
      newComment.postId.toString(),
]);

The queryKey is unique in the component. Should this be:

const previousComments = queryClient.getQueryData([`/posts/${postId}/comments`]);

or did I totally misunderstand the react-query usage?

Looking forward to your reply :)

Vesper0704 avatar Nov 19 '25 11:11 Vesper0704