The InputCity Component
Understand how to create the InputCity component that includes a text input for city names and a submit button to handle searches. Explore how to manage props such as onSubmitHandler, city, and onInputHandler to make the component interactive and functional within a React weather app context.
We'll cover the following...
We'll cover the following...
The InputCity.js component provides us with a search box. In it, we write the name of the city and add a “search” button to initiate an API call. Let’s begin by creating a search bar. Our InputCity component accepts the onSubmitHandler, city, and onInputHandler properties, which are passed once the InputCity component is imported into the App.js file. This can be observed in the following code:
const ...