0

react.js documentation has following variable declarations:

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

Could you tell what does it meant? Thank you.

code1n
  • 136
  • 1
  • 4

2 Answers2

3

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

Alexandre Kirszenberg
  • 35,938
  • 10
  • 88
  • 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
  • 1,010
  • 1
  • 10
  • 18