【问题标题】:Understanding Output from import/export了解导入/导出的输出
【发布时间】:2018-05-08 11:20:27
【问题描述】:

因此,我在理解 Import/Export Statement 的输出时遇到了挫折。

所以假设,如果我做这样的事情

import React, { Component } from 'react';
import Cperson from '../components/person/person.js';

console.log(Cperson)

我在 console.log 中将此作为输出

Cpersons() {
    _classCallCheck(this, Cpersons);

    return _possibleConstructorReturn(this, (Cpersons.__proto__ || Object.getPrototypeOf(Cpersons)).apply(this, arguments));
  }

谁能解释一下console.log 告诉我什么?

提前致谢

【问题讨论】:

标签: javascript reactjs import


【解决方案1】:

在反应导入中意味着在您当前的文件中提供一些东西。 假设如果您在 people.js 中有一个组件,您可以在此处将其用作带有尖括号的“componentName”

或者如果你有这样的文件结构

module.exports = {

Slider_Arrow_Icon: {
  //write your logic here
  back_Arrow_Icon: require('../images/arrow-slide-back'),
  next_Arrow_Icon: require('../images/arrow-slide-next')

},

卡片:{

card: require('../images/payment-icon/card')

}

} 然后你可以像导入一样
导入 {Slider_Arrow_Icon, Card} 表单“文件名”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-05
    • 2023-03-10
    • 1970-01-01
    • 2015-05-28
    • 2015-04-14
    相关资源
    最近更新 更多