Previews in Next.js using GraphQL

Hi, are there any examples that show how I can enable previews using the PrismicLink for GraphQL?
I see the docs for integrating GraphQL (in general) but I don’t see any examples of enabling preview with Next.js using this setup.

Thanks.

I came across https://github.com/zeit/next.js/tree/canary/examples/cms-prismic. It is a complete example with previews integration that uses the REST api. You could switch out the data fetching part to PrismicLink and useQuery and it should work.

Thanks for the reply.

Yeah, I’ve looked at that example but my setup is quite different :sweat_smile:.

I’m using babel-plugin-graphql-import so all my queries are in separate files to keep things organized.

I’ve noticed that they are changing the ref here, but how would that work using useQuery?