TypeError: Cannot read properties of null (reading 'useEffect') #5419
Send to my agentDescribe the bug#
Hello everyone, I need your help.
During project development everything work so well, and no error. But compiling into production I started having this error when I try to run the nextjs application using this
node ./index.js
below is the error messages
- error TypeError: Cannot read properties of null (reading 'useEffect') at Module.useEffect (C:\ProjectDevelopment\project\node_modules\react\cjs\react.development.js:1634:21) at QueryClientProvider (file:///C:/ProjectDevelopment/project/node_modules/@tanstack/react-query/build/lib/QueryClientProvider.mjs:46:9)
Your minimal, reproducible example#
i don't have a link
Steps to reproduce#
- I install tanstack@react-query
- Installed react/react-dom for a UI component depending on it on nextjs
- Using a nextjs custom server
- compile using tsc
- run node ./index.js
Expected behavior#
Everything compile properly at first, but then when I try to open the package then I get this
TypeError: Cannot read properties of null (reading 'useEffect')
So what I expect to happen is for the react-query to work, either for the page to load successfully
How often does this bug happen?#
Every time
Screenshots or Videos#
Platform#
- OS: Windows 11
- Browser: Chrome
- Version 113.0.5672.93
Tanstack Query adapter#
react-query
TanStack Query version#
4.29.7
TypeScript version#
4.7.4
Additional context#
I want to know what step I need to take to fix this as soon as possible.
TkDodo closed this
TkDodo added labelsduplicate
I did but can't find any solution. Please help me 🙏
it's a nextJs issue. Please ask for advice on their linked issue, or downgrade to 13.3
Found a solution, I will try it. Thanks
Found a solution, I will try it. Thanks
Hey ! @dexter4life I experimenting the same in my nx monorepo, so as i can see, you find a solution, can you shared it with me :( ???
Thanks for your answer and have a good day !
@wilfriedago you will need to add this
experimental: { appDir: false },
to your nextjs config file.
@dexter4life i try it, but it not working, i'm not using appDir, and i'm inside a nx monorepo
Up. Does anyone still have this issue?
yes on version 13.4.1, but it was resolved when I update to version 13.5.5
hmm.. I'am not in nextjs project but react
Sign in to join this conversation.
I don't think you spent any time searching the closed issues, because there is a closed issue with the exact same title: