Variable declaration in reactjs documentation [duplicate]

此生再无相见时 提交于 2019-12-25 14:07:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!