react-responsive-carousel icon indicating copy to clipboard operation
react-responsive-carousel copied to clipboard

Carousel' cannot be used as a JSX component Error if using yarn2 pnp mode with typescript

Open winty56 opened this issue 1 year ago • 0 comments

I share solutions for people who are experiencing issues like #634

This problem caused by ghost dependencies in yarn pnp mode. It because @types/react package is not defined as the package's peerDependencies, so the type of react cannot be found.

I leave a fix for those who have experienced the same problems as me.

add below code in .yarnrc.yml file in your project root (Of course @types/react must be defined in your project's package.json :) )

packageExtensions:
  "react-responsive-carousel@*":
    peerDependencies:
      "@types/react": "*"

winty56 avatar Jul 19 '24 01:07 winty56