Echo JS 0.11.0

<~>

xat comments

xat 2803 days ago. link 3 points
90s, that's when I started with web development, too. Back then it was all about animated GIFs. So basically nothing has changed ;)
xat 2803 days ago. link 2 points
Loving Nightmare.js too :)

To be fair, for the testing stuff you probably need some additional dependencies. For example, I'm usually using a combination of tape und nightmare.js.
xat 2804 days ago. link 1 point
This is like saying: "Higher order functions" is the same thing as mixins. Those are different concepts.

I never doubted that there are other concepts in Vue.JS which enable you todo some of the same things. In my initial post I was talking explicity about Higher order components.

However, let's just agree to disagree on this topic ;)

PS: Even if you don't seem to enjoy it, I like discussing stuff like this and finding an answer that everyone agrees on. It doesn't have anything todo with who is right or wrong.
xat 2804 days ago. link 1 point
So maybe we can both agree on this statement:

Higher order components are not that well supported in Vue.JS, but you have mixins, which can be used todo some of the things that you would be able todo with higher order components.
xat 2806 days ago. link 1 point
So for the sake of completeness I did some more digging. It turns out that you don't need JSX todo that. In fact it probably doesn't even help you to solve the problem that much.

The main problem is that you have this nested data object in Vue.JS which you pass down, whereas in React you have a flat props object (which also includes children). So you need special logic to merge that complex data object. I'm also not so sure how you would merge stuff like slots, clickHandlers etc.

Here is a demo which works at least for classes, styles, attributes and properties:

https://jsfiddle.net/urh7sm5a/10/

However, I don't really think it's a practical solution.
xat 2806 days ago. link 1 point
Ok, I see. I somehow hoped that there is a better solution :) . This means practically, that you have to pull in JSX into your Vue.JS project, just to have a sane way to create higher order components. I guess otherwise you normally wouldn't use JSX in a common Vue.JS codebase, unless you are doing some fancy stuff.

I still think that React really shines in that discipline compared to the other ones mentioned.
xat 2807 days ago. link 1 point
Nice! Thanks for the code snippet :-)
You are right, that's not any less elegant than in React.

Is there also a nice solution for these kind of constructs in Vue.JS?

function createComponentWithDefaultProps(Component, defaultProps) {
  return function(props) {
    return <Component {...defaultProps} {...props} />
  }
}
[more]