Use InputCity Component
Understand how to integrate the InputCity component in a React weather app by managing city state with useState hooks. Learn to handle user input changes and form submission to update the city value dynamically, setting the foundation for fetching weather data with an API.
We'll cover the following...
We'll cover the following...
We’ll now pass the values into the onSubmitHandler, city, and onInputHandler props that we used in the InputCity component in the previous lesson.
Add the city prop
The city prop stores the city value given by the user. We’ll do this by using the useState hook. The snippet below demonstrates how to add the city prop.
const [inputCity, setInputCity] = ...