Skip to content

withUrqlClient with exchange-graphcache example(next.js)? #3325

Answered by JoviDeCroock
zeing asked this question in Q&A
Discussion options

You must be logged in to vote

Your description is quite unclear here 😅 what didn't work...

Generally how it would look is as followed:

import { fetchExchange } from '@urql/core';
import { relayPagination } from '@urql/exchange-graphcache/extras'
import { cacheExchange } from '@urql/exchange-graphcache'

const cache = cacheExchange({
  resolvers: { YourType: { field: relayPagination() }}
})

export default withUrqlClient(
  ssrExchange => ({
    url: 'https://trygql.formidable.dev/graphql/basic-pokedex',
    exchanges: [cache, ssrExchange, fetchExchange],
  }),
  { ssr: true }
)(YourComponent;

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@zeing
Comment options

@kitten
Comment options

@zeing
Comment options

@kitten
Comment options

@zeing
Comment options

Answer selected by kitten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants