Cannot find module '@tanstack/react-query-next-experimental' or its corresponding type declarations.
Unanswered
Spectacled Caiman posted this in #help-forum
Spectacled CaimanOP
hi guys,
i am building a web app usingnext.js + tanstack query.
i set Provider.tsx util file like above, and i am getting the below error.
Cannot find module '@tanstack/react-query-next-experimental' or its corresponding type declarations.
what is wrong and how can i fix?
(*both next.js and tanstack query are the latest version)
i am building a web app usingnext.js + tanstack query.
'use client'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import React from 'react'
import { ReactQueryStreamedHydration } from '@tanstack/react-query-next-experimental'
export function Providers(props: { children: React.ReactNode }) {
const [queryClient] = React.useState(
() =>
new QueryClient({
defaultOptions: {
queries: {
staleTime: 60 * 1000,
},
},
}),
)
return (
<QueryClientProvider client={queryClient}>
<ReactQueryStreamedHydration>
{props.children}
</ReactQueryStreamedHydration>
{<ReactQueryDevtools initialIsOpen={false} />}
</QueryClientProvider>
)
}i set Provider.tsx util file like above, and i am getting the below error.
Cannot find module '@tanstack/react-query-next-experimental' or its corresponding type declarations.
what is wrong and how can i fix?
(*both next.js and tanstack query are the latest version)
6 Replies
Satin Angora
Did you install the appropriate types?
Spectacled CaimanOP
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@tanstack/react-query": "^5.8.2",
"@tanstack/react-query-next-experimental": "^5.8.2",
"next": "14.0.2",
"react": "^18",
"react-dom": "^18",
"zustand": "^4.4.6"
},
"devDependencies": {
"@tanstack/react-query-devtools": "^5.8.2",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"eslint": "^8",
"eslint-config-next": "14.0.2",
"typescript": "^5"
}this is dependency list.
Cape horse mackerel
try to restart IDE
Cape horse mackerel
is it working?
Cape horse mackerel
deleting
node_modules and .next folder also help in some cases 🙂Spectacled CaimanOP
Thanks, buddy!