-
Notifications
You must be signed in to change notification settings - Fork 308
TypeError: Class constructors cannot be invoked without 'new' #443
Comments
Yes, it should, and there shouldn't be any difference between the function call and the decorator. I cannot reproduce this using JSBin, so I suspect there may be some other interaction with exports at play? Can you provide a repro in a github repro or bin? |
Sure! Here it is.
(The lib versions are in the to run:
result
Maybe this is only a problem with server side rendering? No export in that repro any way. |
Ah, so the issue here is that the Radium enhancer class is compiled to ES5, which doesn't play nice when it tries to extend a native class. See also tvcutsem/harmony-reflect#55 and lodash/lodash#1193. Your only solution is to transpile your code before running in a newer version of node. |
Ah OK.. Makes sense.. Was hoping that I would not have to transpile server side (except for react and som unsupported es7 features) now that Node has gotten more es6 compatible. I guess I cab get away with only transpiling classes in this case. Do you know if this is likely to change in the future, so that es6 classes can be used with Radium? |
And thanks for taking your time to investigate this! |
confirmed that using |
Since Radium overrides the render method, inheritance is the only mechanism
|
Hi.
I've been using Radium for a while and it's been working great!
However, since babel dropped support for decorators, I am experiencing an issue where I can't wrap a component (which is an ES6 class) with Radium.
Error
This works
This does not
I do not know if using radium as a function (as opposed to using it as a decorator) works with an ES6 class, but your documentation suggests it should.
Thanks in advance!
The text was updated successfully, but these errors were encountered: