react-select icon indicating copy to clipboard operation
react-select copied to clipboard

Using React Select in CodePen

Open dgwyer opened this issue 7 years ago • 8 comments

I'm having a little difficulty using the React Select component in CodePen:

https://codepen.io/dgwyer/pen/YzzGmab

How do you import the component into the pen when including it via a CDN rather than installing as a local dependency? e.g. Something like:

const {Select} = 'react-select';

Perhaps this method could be added to the docs too?

scrn

dgwyer avatar Oct 19 '19 08:10 dgwyer

Were you able to find a solution ?

Sedaj avatar Apr 30 '20 14:04 Sedaj

Not yet, I still can't get it to recognize the 'react-select' component.

dgwyer avatar Apr 30 '20 14:04 dgwyer

Hi @dgwyer,

It appears you can use react-select via a CDN with the following code - https://stackoverflow.com/questions/53927307/how-to-import-from-react-select-cdn-with-react-and-babel

Let me know if this solves your issue.

bladey avatar Jun 23 '20 06:06 bladey

@bladey Already doing that.

dgwyer avatar Jun 23 '20 09:06 dgwyer

Thanks for replying @dgwyer - and you're saying it's still not working? Your Codepen is out of date and doesn't refer to the method above.

bladey avatar Jun 24 '20 00:06 bladey

The codepen uses a CDN to load the react-select script.

See my original post: "How do you import the component into the pen when including it via a CDN"

dgwyer avatar Jun 24 '20 08:06 dgwyer

Thanks for taking the time to reply to me @dgwyer, much appreciated.

bladey avatar Jun 25 '20 04:06 bladey

Greetings @dgwyer ,

I am combing through trying to resolve outstanding issues and figured I'd take a shot at this. I do not know if anything has changed from when you had last tried, but I was able to successfully create an account and project to run react-select

I followed the directions here which was just posted 2 weeks ago, so I will assume that this is a relatively new process, but one that worked for me.

Apparently there is a new feature that will allow a project to import npm modules from a cdn and the codepen bundler can be enabled to process them. The very bottom of the page has a link referring to the necessary build process for JSX projects and I copied the project example and adapted it to work with react-select.

Please feel free to fork this project and let me know if it works for you. If not, we can always reopen the issue.

Cheers and best of luck!

ebonow avatar Dec 04 '20 01:12 ebonow