Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Interesting to see this implemented as a mixin when they just announced yesterday they are fully supporting es6. Looking forward to building some side projects with this and seeing how it compares to using react + flux.


Hi, I wrote this blog post.

We were trying to keep our API surface area small with one way to load data into components, but you're right -- we should probably /also/ add a ES6 base class as a second option, and let the people choose which they prefer.

A lot of React developers still prefer mixins -- react-router recently switched from mixins to ES6 classes and then changed their mind "until ES6 classes have better answers to replace what mixins do (like decorators).": https://github.com/rackt/react-router/blob/master/UPGRADE_GU...


> we should probably /also/ add a ES6 base class as a second option, and let the people choose which they prefer.

Please provide a higher-order component or ES7 decorator (assuming ES7 will be supported?), would rather not use inheritance.


^ this. Id much rather use a decorator with ES7 then extending out classes. Although, i thought i heard that react is working on making some better alternative to mixins


That is very disappointing. Decorators already exist in Babel and they work perfectly. I don't know what they're waiting for


I suspect they're waiting for the proposal to be more stable for the official integration. This seems like a great opportunity for the community to write a decorator and let a convention form before it gets merged into the core framework


There's a more detailed discussion about mixins vs. other data loading methods on this GitHub issue: https://github.com/meteor/react-packages/issues/25#issuecomm...


The community is pretty divided and es6 classes are fairly controversial. Don't be too surprised to see a lot of people avoid them. On purpose. And it's not because they aren't familiar with OOP.


That may be the case with the node community, however AFAICT the React community seems much more open to fully utilizing ES6


Its the javascript community as a whole that is divided, generally between imperative/OOP and functional devs. Has nothing to do with Node or otherwise.

Even if you like classical inheritance, the Class keyword is poorly implemented for it, from both a normal OOP language's point of view OR from a prototypal inheritance point of view. It's bad at both.


Classes are fine if you understand they're just syntactic sugar for the already extremely widespread constructor+prototype pattern.

The primary reason a significant part of the community hates the ES6 classes is that the class keyword is misleading for people who don't understand prototypal inheritance.

The OOP vs FP divide is orthogonal to that as the FP devs in question generally disagree with the constructor+prototype pattern to begin with (and often shun prototypal inheritance entirely).

There's also the people who want JS to be more like Haskell/Lisp, but they've mostly moved to LiveScript and ClojureScript and only occasionally complain from the sidelines.


> There's also the people who want JS to be more like Haskell/Lisp, but they've mostly moved to LiveScript and ClojureScript

You forgot about Purescript:

http://purescript.org/


What exactly is bad about ES6's `class` from a classical inheritance point of view?


I've been creating an application with Meteor and React* and it has been pretty easy thus far. Although I'm not using the official Meteor-React package, it does a lot of the same things that the official package does. The unofficial package also uses a mixin to use with React classes.

*edit: Meant to say React instead of flux


I would love to see this. I really love flux and want to get flux into it, not just react. If it's open source, I'd really appreciate a github link :D.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: