Re:Why we chose Vue.js over React
by floriferous on Sunday December 11, 2016 @03:52PM
(#13153121)
Not sure I understand your 3rd pattern, what does
const {LoginForm} = this; do?
[ Parent
| on HN ]
It is basically equivalent to `LoginForm = this.LoginForm`. It is called destructuring and is one of the nice conveniences of es6 javascript. Importantly you can also do this:
var o = {p: 42, q: true};
var {p, q} = o;
console.log(p); // 42
console.log(q); // trueIt destructures this, to get the LoginForm property, it could be written <this.LoginForm> because even if it starts with a lower case character that are transformed as string when there is a dot it is transformed as object :
<component /> compiles to React.createElement('component') (html tag)
<Component /> compiles to React.createElement(Component)
<obj.component /> compiles to React.createElement(obj.component)