In this unit, you externalize the Application Header in an ECMAScript 6 module.
Create a new file named Header.js
in the js
directory.
Import the react
module:
import React from 'react';
Move the Header
class definition from app.js
into Header.js
.
At the bottom of the file, export the class as the default export:
export default Header;
In app.js
make sure you removed the Header
class definition
Add an import
statement at the top of the file to import the newly created Header module:
import Header from './Header';
Build the app:
npm run webpack
Open index.html in your browser and test the application
The final code for this step is available in this branch.