ReactJS Reflux using mixins with ES6

How do you solve reflux mixins using ES6?

Like this:

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

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

Reaction v 0.14.7 Reflux v 0.4.0

+5
source share
2 answers

Theoretically, mixtures work for a reaction of 0.14.

They do not work if you use ES6 syntax (especially classes). In ES6, we use high-order components instead.

You cannot just replace reflux mixins with some ES6 syntax. You should find no mixins solution for reflux. This is interesting:

https://github.com/reflux/refluxjs/issues/225

And there are some links that may help you:

https://www.npmjs.com/package/reflux-provides-store https://www.npmjs.com/package/reflux-state-mixin

Or you can try creating a high-order component from mixins with this component:

https://github.com/timbur/react-mixin-decorator

+1
source

Reflux now has the React ES6 API.

See here: https://github.com/reflux/refluxjs#react-es6-usage

All that v5 + has is ES6 capability.

+1
source

Source: https://habr.com/ru/post/1244919/


All Articles