看到开头一段这样奇怪的写法
var {
AppRegistry,
StyleSheet,
Text,
View,
} = React;
这是个什么写法? 这样写有什么好处呢?谢谢
补充:
其实,这只是一个语法糖而已,比如AppRegistry我们可以这样定义:
var AppRegistry = React.AppRegistry;
ES6中的解构赋值
看到开头一段这样奇怪的写法
var {
AppRegistry,
StyleSheet,
Text,
View,
} = React;
这是个什么写法? 这样写有什么好处呢?谢谢
补充:
其实,这只是一个语法糖而已,比如AppRegistry我们可以这样定义:
var AppRegistry = React.AppRegistry;
ES6中的解构赋值