Creating Function-Based Components

Learn about the function-based components for the header of our app.

In this section, we are going to start by creating a component for the header of our app, which will contain our app name and the ability to search for questions. Then, we’ll implement some components so that we can start to build the home page of the app, along with some mock data.

Creating a Header component

We can create a basic Header component and reference it within our App component by carrying out the following steps:

  1. Create a new file called Header.tsx in the “src” folder.

  2. Import React into the file with the following import statement:

Get hands-on with 1200+ tech skills courses.