Before we would require npm packages or other files from our project. Now, we use the import syntax.

import axios from 'axios';

Is the same as saying

const axios = requre('axios');

We can also "unpack" only the methods or items that we need from the package or file.

import { Component } from 'react';

Export

Export is generally the same, except you can export multiple items. When this file gets imported, all these items will be packaged into the imported object.

You no longer say:

module.exports = codeOrFunctionOrObjectOrWhatever;

but instead say:

export codeOrFunctionOrObjectOrWhatever;

You can export however many items you'd like, and when they are imported, the import statement can specify which item it wants imported. You can also have an export default which will be exported if the import statement doesn't specify what it wants.

export default codeOrFunctionOrObjectOrWhatever;