Skip to content
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

'ReactCSSTransition' cannot be used as a JSX component. Its instance type 'CSSTransition<HTMLElement | undefined>' is not a valid JSX element. #855

Open
Khoby-790 opened this issue Sep 26, 2022 · 6 comments

Comments

@Khoby-790
Copy link

What is the current behavior?
'ReactCSSTransition' cannot be used as a JSX component.
Its instance type 'CSSTransition<HTMLElement | undefined>' is not a valid JSX element.

What is the expected behavior?
It should be able to resolve with react 18

i updated to react 18 and my transition is breaking

Could you provide a CodeSandbox demo reproducing the bug?
Its instance type 'Provider' is not a valid JSX element.
The types returned by 'render()' are incompatible between these types.
Type 'import("/Users/khoby/Kodes/Livoh/weba-app/node_modules/@types/testing-library__react/node_modules/@types/react/index").ReactNode' is not assignable to type 'React.ReactNode'.

@Art1xFX
Copy link

Art1xFX commented Sep 27, 2022

Had the same problem.
My application has the following dependencies:

Package Version
react ^18.2.0
react-dom ^18.2.0
react-scripts ^5.0.1
react-transition-group ^4.4.2
@types/node ^18.7.18
@types/react ^18.0.0
@types/react-dom ^18.0.0
@types/react-transition-group ^4.4.4
typescript ^4.8.3

I've tried to upgrade versions of @types/* packages using yarn specifying the latest versions of ones:

yarn upgrade react@^18.2.0 react-dom@^18.2.0 @types/react@^18.0.21 @types/react-dom@^18.0.6 react-transition-group@^4.4.5 @types/react-transition-group@^4.4.5

But it did not work. So, after that i tried to update all packages with yarn upgrade command without any parameter:

yarn upgrade

It helped me. May be it will help you too

@ltsfran
Copy link

ltsfran commented Oct 28, 2022

I have the same problem, I had to add resolutions property in my package.json with 17.0.38 version of @types/react

@angelikatyborska
Copy link

I experienced the same issue. Messing around with dependency versions didn't help me. Turns out in my case the issue was caused by conflicting type definitions for JSX.Element between React and Vue, see: vuejs/core#1033

I forced my app to compile by following the recommendation from vuejs/core#1033 (comment) and applying a local patch to Vue that removes the conflicting type (thankfully I only needed TypeScript to work with React in my project).

@mmoreno2-rbi
Copy link

I'm having the same issue after running yarn upgrade.
I'm using react 18, and adding resolutions property didn't work

@dzmitryshkindzer
Copy link

dzmitryshkindzer commented Dec 11, 2023

+1

@axe312ger
Copy link

Good old npx yarn-deduplicate && yarn helped me.

Otherwise.. delete your lock file and do a fresh install :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants