ios - 请问一下这句话是什么意思?
高洛峰
高洛峰 2017-04-17 17:58:23
0
2
347

React 是通过require引入进来的。如图:

方括号内部的各种元素也是通过require方式引进来的。

那么第一幅图中的语句是什么意思呢?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(2)
Peter_Zhu

In ES5, if you use the CommonJS standard, the introduction of the React package is basically done through require. The code is similar to this:

//ES5
var React = require("react-native");
var {
    Image,
    Text,
    PropTypes
} = React;  //引用不同的React Native组件

In ES6, the import writing method is more standard

//ES6
import React, {
    Image, 
    Text,
    PropTypes
} from 'react-native';

Note that in React Native, import will not work properly until 0.12+.

伊谢尔伦

Figure 1 is the writing method of ES6, destructuring assignment, simple usage:
Array:
var [a, b, c] = [1, 2, 3];var [a, b, c] = [1, 2, 3];
对象:
var { foo, bar } = { foo: "aaa", bar: "bbb" };Object:

var { foo, bar } = { foo: "aaa", bar: "bbb" };🎜
var test = { foo: "aaa", bar: "bbb" };
var { foo, bar } = test;
console.log(foo) // "aaa"
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template