Skip to content
This repository was archived by the owner on Aug 19, 2022. It is now read-only.
This repository was archived by the owner on Aug 19, 2022. It is now read-only.

Radium wrapping not compatible with native classes? #576

@epsitec

Description

@epsitec

I've been successfully using Radium with the standard es2015 Babel preset.

Since our generated code runs on Node 5, I wanted to try out babel-preset-node5. With this preset, Babel is no longer translating class to ES5 constructs, since Node 5 supports classes out of the box.
However, when wrapping our component classes with Radium, I get this error:

TypeError: Class constructors cannot be invoked without 'new'

Here is a code snipped which reproduces the error:

import React from 'react';
import radium from 'radium';

class Foo extends React.Component {
  render () {
    return <div>Hello</div>;
  }
}

const WrappedFoo = radium (Foo);

new WrappedFoo (); // TypeError: Class constructors cannot be invoked without 'new'

My .babelrc:

{
  "presets": ["stage-0", "node5", "react"]
}

There seems to be some logic in the Radium wrapper that is not compatible with
real ES2015 classes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions