Uncaught ReferenceError: React is not defined
jwamsterdam opened this issue ยท 15 comments
The default example on Github gives me the following error: Uncaught ReferenceError: React is not defined
- Make sure you've installed
react
. - If you're using webpack, try using webpack's
Provideplugin
to autoload the React module. Check https://stackoverflow.com/questions/35341994/uncaught-referenceerror-react-is-not-defined/41951849#41951849
Hi @selvagsz Thank you. I am including your package in an already compiling react project. I think the include react from 'react', is missing in your package.. could that be the case? I am not sure if I can add ProvidePlugin to my create-react-app project without ejecting it..
Can you check replacing your import with import React, { Component } from 'react';
in the example from readme ?
@jwamsterdam Think I was able to reproduce the issue with CRA. Haven't tested the pkg with CRA before. Fixing it
great!
Hi @selvagsz while you are working on CRA, I also get this warning ;-)
bundle.js:11711 Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see https://fb.me/prop-types-docs
Fixed the import issue & published 1.0.0-beta.5. Do check & lmk
Reg propTypes warning, had that in my todos. Have created new issue for it now #3
Great, it is building!
needs some more debugging, but until now, I dont see the component rendered to the frontend.. keep you posted..
The following gets rendered to my DOM, when I use the code example on your page..
<div class="PowerSelect undefined " tabindex="0"><div class="PowerSelect__Trigger"><span class="PowerSelect__TriggerLabel"><span class="PowerSelect__Placeholder"></span></span><span class="PowerSelect__TriggerStatus"></span></div></div>
So it will not result in any visual component displayed..
@jwamsterdam Import the CSS in your bundle import 'react-power-select/dist/react-power-select.css'
. I've just updated the readme
Great, works!
One question though, does your package (in my case the type ahead component) not work with a value property to pass the value of the selected field to react?
You can use selected
prop. Have a look at the example https://github.com/selvagsz/react-power-select/blob/master/docs/app/Demos/TypeAhead/ArrayOfObjectsDemo.js#L27
Thnx, works like a charm!