selvagsz / react-power-select

A highly composable & reusable select/autocomplete components

Home Page:https://selvagsz.github.io/react-power-select/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught ReferenceError: React is not defined

jwamsterdam opened this issue · comments

The default example on Github gives me the following error: Uncaught ReferenceError: React is not defined

commented

@jwamsterdam

  1. Make sure you've installed react.
  2. 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..

commented

Can you check replacing your import with import React, { Component } from 'react'; in the example from readme ?

commented

@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

commented

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..

commented

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

Thnx, works like a charm!