News for hackers. Stuff that matters.
Re:Using ES7 Decorators as Mixins by elierotenberg on Friday June 26, 2015 @05:49PM (#9787962)
One really useful pattern is React higher-order components, eg. https://github.com/elierotenberg/react-nexus#componentgetnex...

The pattern is

  function decorate(params) {
    return (Component) => class extends React.Component {
      ... // some code using params
      render() {
        return <Component {...this.props} />
      }
    };
  }
my2c.
Re:Using ES7 Decorators as Mixins by mikewhy on Friday June 26, 2015 @06:29PM (#9788123)
I haven't seen that usage for higher-order components before. This is the pattern I've been following:

    function decorate (Component) {
      let HigherOrderComponent = React.createClass({
        render () {
          return <Component {...this.props} />
        }
      })
      
      return HigherOrderComponent
    }
as explained here: https://medium.com/@dan_abramov/mixins-are-dead-long-live-hi...
Re:Using ES7 Decorators as Mixins by HeyImAlex on Friday June 26, 2015 @07:03PM (#9788243)
They are the same I think, only one has extra parameters. At least in Python, @fn(...args) evaluates the function first and uses the result as a decorator. The guy who wrote the blog post you mention actually uses the parent's pattern in react-dnd.
Re:Using ES7 Decorators as Mixins by amccloud on Friday June 26, 2015 @04:23PM (#9787501)
This works really well with React components
Re:Using ES7 Decorators as Mixins by Ronsenshi on Friday June 26, 2015 @07:22PM (#9788309)
Kinda makes me feel incompetent.

Just started using ES6 in nodejs and here are people already gunning for ES7. Amazing.

Re:Using ES7 Decorators as Mixins by braythwayt on Friday June 26, 2015 @09:37PM (#9788719)
The subtext of this article is that underneath all this glitzy new syntax, class mixins are absolutely nothing new. The semantics are the same. The important thing is to focus on the underlying principles and let the syntax evolve as it wishes.
Re:Using ES7 Decorators as Mixins by nuxi7 on Friday June 26, 2015 @09:32PM (#9788706)
dude, es6 is way too mainstream for cutting edge web programming. If you're not using es7 already you might as well still be using table layouts
Re:Using ES7 Decorators as Mixins by huxley on Friday June 26, 2015 @10:46PM (#9788895)
I've started writing my own ES9 specification to get a jump on the really cutting-edge stuff, it's influenced by functional languages but only ironically.
Re:Using ES7 Decorators as Mixins by girvo on Friday June 26, 2015 @09:43PM (#9788735)
Don't stress, while ES7 is exciting (and I'm using parts of it, async/await alone are worth using) a fair bit of it is still up in the air. Unless there are particular features you'd like (for myself that is async/await and decorators), es6 alone is well worth it.
Re:Using ES7 Decorators as Mixins by jjawssd on Friday June 26, 2015 @08:38PM (#9788563)
Don't get worked up over this. Let the dust settle and the smoke clear. Take a deep breath and relax. You'll need it in the JS community.
Re:Using ES7 Decorators as Mixins by dominotw on Friday June 26, 2015 @05:23PM (#9787832)
I want to try decorators but I really dislike javascript classes.
Re:Using ES7 Decorators as Mixins by Bahamut on Friday June 26, 2015 @05:42PM (#9787924)
You don't have to use them with just classes: https://github.com/wycats/javascript-decorators
Re:Using ES7 Decorators as Mixins by dominotw on Sunday June 28, 2015 @12:19PM (#9794026)
All the examples seem to be using classes. I think I am missing something here.

Can you point me to an example without es6 classes?