Most Basic Solution
Below is a basic version of Showcase and App
to illustrate how functional components and JSX come together.
// src/Showcase.jsx (Basic Version)
/*
// Pseudocode comments:
// 1. Define a functional component called Showcase
// 2. Return a simple JSX with an <h1> element
function Showcase() {
return (
<div>
<h1>Showcase Component</h1>
</div>
);
}
export default Showcase;
*/
// src/App.jsx (Basic Version)
/*
// Pseudocode comments:
// 1. Import React and the Showcase component
// 2. Return a main container with Showcase inside
import Showcase from './Showcase';
function App() {
return (
<div>
<Showcase />
</div>
);
}
export default App;
*/
With these two files in place, when you run npm run dev in
your React application, you should see "Showcase Component" on
the page. This is enough to show you how a separate functional component
can be imported and used inside another component. Next, we'll add
more interesting JavaScript expressions, images, and styling.