For the sake of simplicity, I am adding a React component. This React component is going to simulate a real life scenario of the component that is responsible for including the <header-image> web component. Let this React component be MainBody; its definition would look something like this:
import React, { Component } from 'react';
export default class MainBody extends Component {
render() {
return (
<div>
<p>This is the main body</p>
</div>
);
}
}
As you can see, it shows just one line of text and nothing else. If you have a more complex component, the steps will be the same. As for the starter app, we will include this MainBody component in our App component first, which is shown here:
import React from 'react';
import logo from './logo.svg';
import './App.css';
import MainBody from './main-body/main-body.js';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
<MainBody />
</header>
</div>
);
}
export default App;
Here, we are simply importing the MainBody component and using it directly in the App component.