I haven't seen this syntax before and would like to know what it means.
var { Navigation } = require('react-router'); The curly brace on the left of will cause a syntax error:
unexpected token {
I'm not sure which part of the webpack configuration does the conversion, or what the purpose of this syntax is. Is this a Harmony thing? Can someone explain this to me?
This isdestructuring assignment. It is a new feature of ECMAScript 2015.
var { AppRegistry, StyleSheet, Text, View, } = React;Equivalent to:
It is calledDestructuring assignmentand is part of theES2015 standard.
Object destructuring
var o = {p: 42, q: true}; var {p, q} = o; console.log(p); // 42 console.log(q); // true // 分配新的变量名 var {p: foo, q: bar} = o; console.log(foo); // 42 console.log(bar); // trueArray destructuring