1

So I am having kind off a set back understanding the output from Import/Export Statement.

So suppose, if I do something like this

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

console.log(Cperson)

I get this as an output in console.log

Cpersons() {
    _classCallCheck(this, Cpersons);

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

Can someone explain me what is console.log telling?

Thanks in advance

Nah
  • 1,690
  • 2
  • 26
  • 46
  • possible duplication of : https://stackoverflow.com/questions/39137582/how-import-statement-works-in-es6-for-react-components Otherwise to context might be too broad to explain, please post only errors or issues you are facing. Otherwise you might never get the answer. – Nah May 08 '18 at 11:26

1 Answers1

0

In react import means to make something available in your current file. Suppose if you have a component in persons.js you can use it here as 'componentName' with angle brackets

Or if you have file structure like this

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: {

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

}

} then you can import like
import {Slider_Arrow_Icon, Card} form 'filename'

Anuj
  • 106
  • 3