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.
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.
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.
This tweet here is quite interesting:
https://twitter.com/_joshburgess/status/842517105459286018
That basically seems to mean that you will get some disadvantages regarding render performance if you use redux in the future, compared to using setState. Hopefully we will get some more insights on that topic.
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.
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.
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} />
}
}