Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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