-
DescriptionI am trying to implement the react-query v3 package into a gatsbyjs project, however I get the following error: import { QueryClient, QueryClientProvider } from 'react-query'
import React from 'react'
export const wrapPageElement = ({ element, props }) => {
const queryClient = new QueryClient();
return (
<QueryClientProvider clien={queryClient}>
{element}
</QueryClientProvider>
)
} Steps to reproducehttps://codesandbox.io/s/7uh7q Expected resultreact-query should fetch the data from the star wars api. Actual resultThe EnvironmentRun |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 5 replies
-
@Notaduck there's a typo in your code example. |
Beta Was this translation helpful? Give feedback.
-
Hi! Your reproduction on codesandbox doesn't work for me, it always fails to start. As probablyup also said you've got a typo in there. Lastly, I'd recommend sharing the code between gatsby-browser.js and gatsby-ssr.js so that you don't create the client twice and do not repeat code as well. |
Beta Was this translation helpful? Give feedback.
-
And that is why it is better to go to sleep instead of opening a issue...... Sry! It is working now |
Beta Was this translation helpful? Give feedback.
-
@Notaduck Why did you reopen? |
Beta Was this translation helpful? Give feedback.
-
That was a mistake, sry! |
Beta Was this translation helpful? Give feedback.
-
Sorry for reopening this gain but I just tried to implement it again.... However it still looks like there is problems. It works just fine in
Prove -> https://github.com/notaduck/use-react-gatsby-demo
|
Beta Was this translation helpful? Give feedback.
-
Moving it, since it's not a bug with Gatsby. Try adding the contents of |
Beta Was this translation helpful? Give feedback.
Moving it, since it's not a bug with Gatsby.
Try adding the contents of
gatsby-browser.js
also togatsby-ssr.js
. During Gatsby build otherwise the client is missing.