Cannot import react-select/creatable
See original GitHub issueHello!
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:
Cannot find module react-select/creatable
I tried to create a custom.d.ts
file with declare 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
and react-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 import react-select/creatable
;
Issue Analytics
- State:
- Created 4 years ago
- Comments:9
Top GitHub Comments
@brunomonteirosud, I think your are not importing the Creatable submodule with
import CreatableSelect from "react-select"
, but the main ReactSelect component. I solved it with:I’m using
"react-select": "^2.4.4"
Sorry @devilcius, I think I am little confused. Are you saying I should import like this
import { Creatable } from 'react-select';
and then use a
<Creatable>
component, instead of a<CreatableSelect>
?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:
https://react-select.com/creatable