[Bug]: TypeError: React.createContext is not a function
See original GitHub issueWhat package within Headless UI are you using?
What version of that package are you using?
1.2.0
What browser are you using?
N/A
Reproduction repository
https://github.com/rgbrizzlehizzle/ba-sing-se
Describe your issue
I am experiencing the same issue raised in https://github.com/tailwindlabs/tailwindui-react/issues/5 😞
I’m a total front-end scrub so apologies if this turns out to be something that is completely my fault lol.
It also seems possible that this is a problem with Jest, but it seemed to make sense to open it up here first since someone else also had the same issue.
Issue can be replicated by cloning the repo that I linked and running yarn test
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
Top Results From Across the Web
"React.createContext is not a function" - but I am not using it
createContext is not a function " error while running a react-native application. I searched for 'createContent' in the code, it doesn't exist.
Read more >Uncaught TypeError: _react.default.createContext is not a ...
I'm getting this error and the app won't render: Uncaught TypeError: _react.default.createContext is not a function at Object.
Read more >The child node of a React context consumer ... - DeepScan
REACT_BAD_CONTEXT_CONSUMER_CHILD; Error; High; react. This rule applies when the child ... (TypeError: render is not a function) <Context.
Read more >[Solved]-"React.createContext is not a function" - appsloveworld
In your package react and react-dom are not having the same version which is why you get the error. react-dom@16.4.0 will want to...
Read more >uncaught typeerror: (0 , react__ ...
The reason you are getting this error is because one of your dependencies (or maybe even your code) relies on React.createContext method. This...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For those encountering this issue, it is likely due to including
.
in themoduleDirectories
section ofjest.config.js
like so:Either removing the
.
or changing it to<rootDir>
solved the issue:A similar issue + solution was reported with theme-ui.
Hi, If you are using Next.js 13 you have to add ‘use client’; to your component. Please for more information check the link below: https://beta.nextjs.org/docs/rendering/server-and-client-components Otherwise, check if you have installed the latest version of react and react-dom.