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

React Select Version > 5.0.0 is incompatible with other libraries #5230

Closed
stanley355 opened this issue Jun 17, 2022 · 5 comments
Closed

React Select Version > 5.0.0 is incompatible with other libraries #5230

stanley355 opened this issue Jun 17, 2022 · 5 comments
Labels
awaiting-author-response Issues or PRs waiting for more information from the author issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet

Comments

@stanley355
Copy link

Are you reporting a bug or runtime error?

A bug: Installed JSX components can't be used after installing React-select
How to reproduce:

  • Create next.js App with typescript
  • Install React select with version > 1.27.6 as for me I installed 1.28.1
  • Install library pure-react-carousel (newest)
  • Create a simple Carousel Component import and use the following component to your carousel component:
    image
  • The issue will come out some third party component can't be used as JSX element:
    E.g my carousel component
    image

And for the next.js built in component will get similar error:
image

Anybody having similar issue?

@stanley355 stanley355 added the issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet label Jun 17, 2022
@Methuselah96
Copy link
Collaborator

Sounds like you have two copies of @types/react installed. Usually the easiest way to resolve this is to delete your package lock file and re-install your packages.

@Methuselah96 Methuselah96 added the awaiting-author-response Issues or PRs waiting for more information from the author label Jun 17, 2022
@stanley355
Copy link
Author

Sounds like you have two copies of @types/react installed. Usually the easiest way to resolve this is to delete your package lock file and re-install your packages.

I've tried removing my node-modules and yarn lock file, and yarn install yet the issue persists

@Methuselah96
Copy link
Collaborator

The issue is that you have multiple copies of @types/react installed. I would recommend looking in your yarn.lock to see what those copies are. If the two copies are @types/react 17 and 18, you need to follow the steps here.

@mikefarquhar
Copy link

mikefarquhar commented Jul 8, 2022

Also had fun with this issue this morning.

react-select depends on react-transition-group which has a dependency on @types/react: * (so version 18 as it's the latest). This turns out to be fine if running NPM v8 (probably also 7?), but causes the above issue when installing with NPM <= 6.

If it's not possible to upgrade your NPM version I can confirm that react-select v5.1.0 (haven't checked anything above that) works fine with TypeScript and NPM v6.

There's an issue over on react-transition-group for further reference, but it looks to me like they've mistakenly installed to dependencies rather than devDependencies.

@Methuselah96
Copy link
Collaborator

It's not a mistake, @types/react-transition-group does correctly depend on @types/react. See facebook/react#24304, facebook/react#24304 (comment), and microsoft/DefinitelyTyped-tools#433 for more details. Closing this since this is not an issue with react-select.

@Methuselah96 Methuselah96 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author-response Issues or PRs waiting for more information from the author issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet
Projects
None yet
Development

No branches or pull requests

3 participants