问题
react.js documentation has following variable declarations:
var { Image, StyleSheet, Text, View } = React;
Could you tell what does it meant? Thank you.
回答1:
This is the destructuring syntax, which is part of ES6.
回答2:
It's a feature of ES6 called destructuring. Essentially the same as writing:
var Image = React.Image;
var StyleSheet = React.StyleSheet;
var Text = React.Text;
var View = React.View;
来源:https://stackoverflow.com/questions/30290963/variable-declaration-in-reactjs-documentation