question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import react-select/creatable

See original GitHub issue

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:

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:closed
  • Created 4 years ago
  • Comments:9

github_iconTop GitHub Comments

14reactions
devilciuscommented, Jul 13, 2019

@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:

import { Creatable } from 'react-select';

I’m using "react-select": "^2.4.4"

1reaction
brunomonteirosudcommented, Jul 14, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creatable in React-Select and Typescript fails with error
I'm trying to use the Creatable part but when I import it I am getting an error. I installed both react-select and @types/react-select...
Read more >
Creatable - React Select
A flexible and beautiful Select Input control for ReactJS with multiselect, autocomplete and ajax support.
Read more >
react-select - npm
Start using react-select in your project by running `npm i react-select`. ... import React from 'react'; import Select from 'react-select'; ...
Read more >
react-select-creatable - CodeSandbox
react -select-creatable ... Environmentcreate-react-app ... Activating extension 'vscode.typescript-language-features' failed: Could not find bundled ...
Read more >
Programmatically Add New Options To Dropdown ... - YouTube
In this video, I will show you how to programmatically add a new item to the select list using react select creatable. React...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found