Skip to content

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

@Vesper0704

Description

@Vesper0704

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions