0

react.js documentation has following variable declarations:

var { Image, StyleSheet, Text, View } = React;

Could you tell what does it meant? Thank you.

code1n
  • 116
  • 1
  • 3

2 Answers2

3

This is the destructuring syntax, which is part of ES6.

Alexandre Kirszenberg
  • 34,953
  • 9
  • 86
  • 72
3

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;
jollelj
  • 980
  • 1
  • 9
  • 18