Amidii Amidii - 10 months ago 67
React JSX Question

ReactJS Reflux using mixins with ES6

How do you solve mixins with reflux using ES6?

Like this:

mixins: [Reflux.listenTo(myStore, "onChange")]

Results in error "Unexpected token" with arrow shown above.

React v 0.14.7
Reflux v 0.4.0

Answer Source

Theoretically mixins works for react 0.14 .

They don't work if you use ES6 syntax (especially classes). In ES6 we use high order components instead.

You can't simply replace reflux mixins by some ES6 syntax. You have to find not mixins solution for reflux. There is interesting thread about it :

And there are some links which may help you:

Or you can try create high order component from mixins by this component: