diff --git a/src/App.jsx b/src/App.jsx
index 6478b09..904b530 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -2,24 +2,67 @@ import { useState } from "react";
import "./App.css";
function City(props) {
- return
This is the City component
;
+ return (
+
+
{props.City}, {props.State}
+
+
+
+ - State:{props.State}
+ - Location:({props.Lat},{props.Long})
+ - Population (estimated): {props.EstimatedPopulation}
+ - Total Wages:{props.TotalWages}
+
+
+
+
+)
}
-function ZipSearchField(props) {
- return This is the ZipSearchField component
;
+function ZipSearchField({onSearch}) {
+ const[zipCode, setZipCode] = useState("");
+
+ const handleChange =(e) => {
+ setZipCode(e.target.value);
+ onSearch(e.target.value);
+ };
+
+ return()
}
function App() {
+ const[cities,setCities] = useState([]);
+ const[error,setError] = useState("");
+
+ const fetchCities = async(zipCode) =>{
+ setError("");
+ try{
+ const response = await fetch(`https://ctp-zip-code-api.onrender.com/zip/${zipCode}`)
+ if(!response.ok)
+ {
+ throw new Error("No results found");
+ }
+ const data = await response.json();
+ setCities(data);
+ }catch(err){
+ setCities([]);
+ }
+ };
return (
Zip Code Search
-
+
-
-
+ {cities.length > 0 ? (
+ cities.map((city, index) => (
+ // Spread city object as props
+ ))
+ ) : (
+ No results found // Fallback message
+ )}