Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Extending FluxContainer instantiation error with Node v6.x and ES6 #351

Description

@nathankellenicki

Hi,

When attempting to extend FluxContainer and create a class from it on the server side in Node v6.x, the component throws an error when instantiated:

TypeError: Class constructor OverviewComponent cannot be invoked without 'new'
    at PureFluxContainerClass.FluxContainerClass (/ProjectLocation/node_modules/flux/lib/FluxContainer.js:50:13)

The component looks like this:

class OverviewComponent extends React.Component {
   ...
}

module.exports = Flux.Container.create(OverviewComponent);

Note that this is not transpiled - this is executed natively with Node v6.x's ES6 support.

I believe this error is because Flux is expecting the component to be transpiled to ES5, and therefore be able to call the constructor be calling it directly, which it can't do in ES6. Is this correct?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions