optimizely / nuclear-js

Reactive Flux built with ImmutableJS data structures. Framework agnostic.
https://optimizely.github.io/nuclear-js/
MIT License
2.23k stars 141 forks source link

Is it possible to use ReactMixin with ECMA6 class extension syntax? #198

Closed eysi09 closed 8 years ago

eysi09 commented 8 years ago

Hi all,

I'm using ES6 class extension syntax to create React components, that is class MyComponent extends React.Component {} rather than React.createClass({}).

However, I'm having problems when using the Reactor.ReactMixin since it seems to call getInitialState() on the component whereas the ES6 react components use the constructormethod instead. Is there a way around this or will I have to stick React.createClass?

raulmatei commented 8 years ago

Hi,

See NuclearJS React addons, which has nuclearComponent high-order component that uses ReactMixin to get the data bindings and then passes the data down as props to the wrapped component.

Raul.

eysi09 commented 8 years ago

Hi Raul.

Thanks for your reply. It seems that method will do the trick.

-Eysi.

raulmatei commented 8 years ago

You're welcome.