-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Provider' cannot be used as a JSX component #1886
Comments
@Methuselah96 , @eps1lon : we've been seeing several reports of this. Is there something else with This issue describing |
This means that there are conflicting versions of If you're using Yarn:
If you're using npm:
|
It works fine with I'm not sure if there's a way to get React types to work with multiple major versions present. Either way, it's always been advisable to only have a single version of |
I put this in my package.json to fix it: you have to have at least version 8 of npm installed to enable I have quite a few dependencies that are using a wildcard * for their @react/types dependencies which is causing this problem. also, if you want to, You can force devs to use that version of npm by putting it in the package.json also had to use npm install --force now which I do not like, but had to get this stop gapped for now. Will be monitoring this and hope to find a better approach such as upgrading or being more specific in my overrides declarations, something like that. |
I am not able to reproduce these issues. Is somebody able to provide either a TypeScript playground or cloneable repository for investigation? |
If you're seeing "SomeComponent cannot be used as a JSX component." after installing React 18 types make sure to only have a single version of The issue is not caused by a specific version of |
I received a similar error yesterday: I first tried to delete the "overrides": {
"@types/react": "17.0.43",
"@types/react-dom": "17.0.14"
}, Today, I tried again to delete the |
Thanks for mentioning the multiple versions @Methuselah96! It's been awhile since I've had to update react types so I forgot about that little tidbit 🤪
We use yarn at my work so I am able to use the "resolutions": {
"@types/react": "^18.0.0"
} to my @kimbaudi I think what you experienced is probably close to what I experienced if you're looking for a possible explanation. Though |
Tried to change "jsx" property from tsconfig.json file to "react" instead of "react-jsx" and it worked. |
I'm going to go ahead and close this, but I'll pin the issue for visibility. |
@kukovisuals : per the above discussion, you need to tell your package manager to force only using Actually the other issue here is that you're also using React 16 as well. Technically you can update the |
Hah, fwiw I didn't even notice that either :) |
|
What version of React, ReactDOM/React Native, Redux, and React Redux are you using?
What is the current behavior?
get this error when i try to run:
'Provider' cannot be used as a JSX component'
I think it has to do with new @react/types v18
What is the expected behavior?
no error
Which browser and OS are affected by this issue?
all
Did this work in previous versions of React Redux?
The text was updated successfully, but these errors were encountered: