The use of export and import with components in React

Hi this is an example how to export and then import a component in react.

This is our component and we are using export default to export the component:

// Dependencies
import React from 'react'

const MyComponent = () => {
  return (
      <p>I'm the component!</p>

export default MyComponent

Then we can use the component in other file, so we can import the component like this:

// Importing component
import MyComponent from './MyComponent.jsx'


By Cristina Rojas.