Echo JS 0.11.0

<~>

xat comments

xat 2838 days ago. link 1 point
Those concepts exist in pretty much any programming language.

@sylvainpv I'm searching the web for Vue.JS examples where a component gets passed in as prop to another component. Not finding anything so far. Do you know if that is even possible? Doesn't this conflict with the reactive data-structure stuff going on in Vue.JS?

To give you a more concrete example:

In the last project we needed inline-editing functionality. The goal was to support different input elements like text, select, etc. and the view could also be different from case to case. This was pretty nice and elegant to solve using a higher order component, which basicly looked like this in React:

<InlineEdit editComponent={SomeInputComponent} viewComponent={SomeViewComponent} value={val} onChange={(newVal) => { /* do something */}} />

How would you approach that in Vue.JS?
xat 2839 days ago. link 1 point
I'm aware of that HOC is not React specific. But it works really nicely in React.

I'm not sure if the example code in that medium article even is a higher order component? Looks more like it's just'n component inheriting stuff from another component?

A HOC is component which gets another component passed in as argument or prop and then returns a new component which wraps that input component somehow.
xat 2839 days ago. link 2 points
I really like Vue.JS and can see me using it, depending on the project.

That beeing said, I think React still has one big advantage over Vue.JS or Angular2. And that it is composition of components using higher order components (HOC). HOC is such a powerful concept, which many developers don't seem to be aware of.
xat 2864 days ago. link 7 points
I don't think finger pointing helps anybody. Eric Elliot and Feross are both well respected in the community. If you have personal problems with them, then better just discuss it directly and in private.
xat 2895 days ago. link 2 points
Guess it depends on the situation. For example, Vue.JS binds methods to the instance of the component. That is a case where passing in the component instance as first parameter into the method would feel strange (at least to me).
xat 2896 days ago. link 1 point
Actually you can't use bind in combination with arrow-functions. The sample code will therefor always output 'undefined'.

EDIT: example has been fixed.
xat 2898 days ago. link 2 points
Nice and elegant module without any unnecessary webpack bloat and thousands of dot-files.
xat 2901 days ago. link 1 point
Hmm, why should it break the asynchronicity behind import()? The import() implementation could just return Promise.resolve(<code of imported module>).

What I was trying to say is, that import() is also the only way to load a module based on a condition. So, if you want to load a module based on condition, you have to use import() regardless if that module is included in the bundle or not.
xat 2904 days ago. link 2 points
I don't agree that those modules should never be part of the bundle.

For example, you could have language files and load them with a function like "loadLang = lang => import(`./languages/${lang}`)". It is totally debatable if those language files should be part of the bundle or not and a decision the developer has to make.
[more]