choojs / nanocomponent-adapters

🔌 - Convert a nanocomponent to a component for your favourite API or library (web components, (p)react, angular)
MIT License
96 stars 17 forks source link

Errors when trying to use inside React JSX #11

Open dmitriz opened 7 years ago

dmitriz commented 7 years ago

Steps to reproduce:

$ create-react-app my-app

then copy the React example inside the App.js file, uncomment ReactDOM.render(<Button />, mountNode), instead trying to put <Button /> directly inside the JSX.

Complained about undefined html, so I had added this line:

var html = require('bel')

The error changed to

assert.js:59Uncaught AssertionError: nanocomponent-adapters/react: component should be type function

in the console and the screen is empty.

dmitriz commented 7 years ago

I have found and removed these assertions that somehow were in the package, perhaps by mistake:

https://github.com/yoshuawuyts/nanocomponent-adapters/blob/master/react.js#L6-L7

Now there is real error though:

warning.js:36Warning: A Component: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.printWarning @ warning.js:36warning @ warning.js:60ReactClass.createClass @ ReactClass.js:628toReact @ react.js:11(anonymous function) @ App.js:19__webpack_require__ @ bootstrap d183399…:555fn @ bootstrap d183399…:86(anonymous function) @ index.js:3__webpack_require__ @ bootstrap d183399…:555fn @ bootstrap d183399…:86(anonymous function) @ bootstrap d183399…:578__webpack_require__ @ bootstrap d183399…:555(anonymous function) @ bootstrap d183399…:578(anonymous function) @ bootstrap d183399…:578

react.js:21Uncaught TypeError: component is not a function

The screen elements are back, but not the button.

yoshuawuyts commented 7 years ago

yeah we should probs switch to prototypes for this, and update to latest nanocomponent. haha

On Sun, May 7, 2017 at 10:32 AM Dmitri Zaitsev notifications@github.com wrote:

I have found and removed these assertions that somehow were in the package, perhaps by mistake:

https://github.com/yoshuawuyts/nanocomponent-adapters/blob/master/react.js#L6-L7

Now there is real error though:

warning.js:36Warning: A Component: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.printWarning @ warning.js:36warning @ warning.js:60ReactClass.createClass @ ReactClass.js:628toReact @ react.js:11(anonymous function) @ App.js:19webpack_require @ bootstrap d183399…:555fn @ bootstrap d183399…:86(anonymous function) @ index.js:3webpack_require @ bootstrap d183399…:555fn @ bootstrap d183399…:86(anonymous function) @ bootstrap d183399…:578__webpack_require__ @ bootstrap d183399…:555(anonymous function) @ bootstrap d183399…:578(anonymous function) @ bootstrap d183399…:578react.js:21Uncaught TypeError: component is not a function

The screen elements are back, but not the button.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yoshuawuyts/nanocomponent-adapters/issues/11#issuecomment-299690473, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWlet86dDdFtRF9IajhVo3LEXe7mKYbks5r3YG2gaJpZM4NTDnQ .

toddself commented 7 years ago

We could also use the create-class shim...