Skip to content

Possible to use React Query and SSR? #1

Description

@KATT

I saw this demo and it looks really cool

Looking at this code:

const [helloResponse, setHelloResponse] = useState('');
const [posts, setPosts] = useState<{name: string}[]>([]);
const fetchPosts = () => trpc.query("post.get").then(setPosts)

It seems like this could be improved with using trpc.useQuery(['post.get']), but unsure if it's possible to:

a) get SSR working with this
b) if the react query cache will be relevant at all / how that would work with fresh in case it uses partial hydration

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