javascript - How to understand this syntax? var {...} = React; -


this question has answer here:

in react native example: https://github.com/facebook/react-native

var react = require('react-native'); var { scrollview, touchablehighlight, text } = react;  var touchdemo = react.createclass({   render: function() {     return (       <scrollview>         <touchablehighlight onpress={() => console.log('pressed')}>           <text>proper touch handling</text>         </touchablehighlight>       </scrollview>     );   }, }); 

what syntax mean?

var { scrollview, touchablehighlight, text } = react; 

i typed in nodejs console cause syntax error. special javascripts syntax react native?

thanks

that destructuring, ecmascript 6 feature. far know not included in version of node.js or iojs yet, there may command line flag can use enable it.


Comments

Popular posts from this blog

SQL php on different pages to Insert (mysqli) -

php - How can an email be returned from Stripe Checkout? -

sql - Partition elimination in Greenplum -