react-transition-group icon indicating copy to clipboard operation
react-transition-group copied to clipboard

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

Open Khoby-790 opened this issue 2 years ago • 7 comments

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<AnyAction>' 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'.

Khoby-790 avatar Sep 26 '22 09:09 Khoby-790

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

Art1xFX avatar Sep 27 '22 06:09 Art1xFX

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

ltsfran avatar Oct 28 '22 15:10 ltsfran

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: https://github.com/vuejs/core/issues/1033

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

angelikatyborska avatar Jan 31 '23 05:01 angelikatyborska

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

mmoreno2-rbi avatar Sep 19 '23 17:09 mmoreno2-rbi

+1

dzmitryshkindzer avatar Dec 11 '23 13:12 dzmitryshkindzer

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

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

axe312ger avatar Dec 19 '23 19:12 axe312ger

yarn dedupe for v3+

m-podlesny avatar May 31 '24 10:05 m-podlesny