Skip to content

Access urql client directly from a component (next-urql) #1054

Answered by kitten
itsfolf asked this question in Q&A
Discussion options

You must be logged in to vote

So I’m not quite sure I understand your goals here.

Accessing the client under a Provider like with withUrqlClient is as easy as using the hooks or using the context with useClient.

So I suppose your question is: How do I query data and use static optimisations? The answer to that is more complicated, because the static optimisation API in Next.js doesn’t really take this into account at all.

If you have next-urql set up for SSR it’ll do so using getInitialProps. If you have a page with it that means that page won’t automatically be statically rendered, if you have it on _app that means no page will automatically be statically rendered.

You can still use the manual method to define static…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@itsfolf
Comment options

@JoviDeCroock
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