in React JS by
Q:

How to import and export components using React and ES6?

1 Answer

0 votes
by

You should use default for exporting the components

import React from 'react'
import User from 'user'

export default class MyProfile extends React.Component {
  render(){
    return (
      <User type="customer">
        //...
      </User>
    )
  }
}

With the export specifier, the MyProfile is going to be the member and exported to this module and the same can be imported without mentioning the name in other components.

Click here to read more about React JS
Click here to read more about Insurance

Related questions

0 votes
asked Jan 30 in React JS by rajeshsharma
+1 vote
asked Mar 2, 2020 in React JS by RShastri
0 votes
asked Mar 30, 2020 in React JS by amita rallin
0 votes
0 votes
asked Mar 2, 2020 in ECMAScript by rajeshsharma
0 votes
asked Mar 1, 2020 in React JS by RShastri
...