Server Error TypeError: react.createContext is not a function #2800
-
Describe the bug`import { createClient, gql } from "urql"; const QUERY = gql export default async function HomePage() { Reproductionhttps://github.com/singh-jay/next13-urql-example Urql versionurql v3.03 Validations
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
You can't use context in server-components hence using a provider/... will always error out, relates to vercel/next.js#41958 |
Beta Was this translation helpful? Give feedback.
-
I'm not using context directly in my server component, the error is coming from the urql package itself. I'm simply creating the client and calling client.query(). Is createClient() method calling the context internally because when using graphql-request or apollo-client then query is executing fine, no context issue. |
Beta Was this translation helpful? Give feedback.
-
yes, urql uses context 😅 just like a lot of other libraries as soon as a library imports createContext it crashes React server components. You can create the client from |
Beta Was this translation helpful? Give feedback.
yes, urql uses context 😅 just like a lot of other libraries as soon as a library imports createContext it crashes React server components. You can create the client from
@urql/core
to get stuff without context but because the library importscreateContext
it fails in Next 13 not much we can do about that tbh...