-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Cannot import react-select/creatable #3660
Comments
As an updated, I found that If that's how it's supposed to be now, maybe we could update the documentation in the example page. Let me know if I should open a PR for that 😄 |
@brunomonteirosud, I think your are not importing the Creatable submodule with import { Creatable } from 'react-select'; I'm using |
Sorry @devilcius, I think I am little confused. Are you saying I should import like this
and then use a I tried that and it looks like it works, but not sure what would be the difference between those 2 components... I am just trying to reproduce the last example (Multi-select text input) from this page: |
@brunomonteirosud For v2 users, if you want to use
or like this
and use it like You can read it in the v2 to v3 upgrade guide here. |
@brunomonteirosud, the difference between the two compenents is that with Creatable users can create new options along with choosing existing options. When you do |
Thank you all! |
If it helps, I got this to work with v3 via: |
Huh... VSCode is not showing Creatable as something importable when trying to import like that but it works... Didn't know that VSCode can jebait with imports :D |
…h @elastic/react-search-ui-views@1.6.0
thanks~~~ this works for me |
I solved this by changing the "moduleResolution" in tsconfig to "Node" instead of "NodeNext". but I prefer to stick to importing from "react-select/creatable/dist/react-select-creatable.cjs" because of using "exports" field in my mono repo package which doesn't seem to work in moduleResolution "Node". |
Hello!
I am trying to use React Select Creatable by following the last example in this page (Multi-select text input):
https://react-select.com/creatable
However, when I try to import this:
import CreatableSelect from "react-select/creatable";
I have the error:
I tried to create a
custom.d.ts
file withdeclare module "react-select/creatable";
, and that fixed the error message but it creates other issues in the project.I am using
@types/react-select: ^2.0.19
andreact-select: 2.4.3
.Here is a reproducible example, forked from the "React Select Creatable" example page mentioned above:
https://codesandbox.io/s/react-codesandboxer-example-wdrsk
Note: I am using
react-select
in other parts of the project and that works fine, the issue only happens when I try to specifically importreact-select/creatable
;The text was updated successfully, but these errors were encountered: