diff --git a/src/App.jsx b/src/App.jsx
index 6478b09..8b5693e 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -1,25 +1,77 @@
import { useState } from "react";
import "./App.css";
-function City(props) {
- return
This is the City component
;
+function City({ city }) {
+ return (
+
+
+
+ {city.LocationText}
+
+
+
+ - State: {city.State}
+ - Location: ({city.Lat}, {city.Long})
+ - Population (estimated): {city.EstimatedPopulation}
+ - Total Wages: {city.TotalWages}
+
+
+
+
+ );
}
-function ZipSearchField(props) {
- return This is the ZipSearchField component
;
+function ZipSearchField({ setCityData }) {
+ const fetchZipcodes = (zipcode) => {
+ fetch(`https://ctp-zip-code-api.onrender.com/zip/${zipcode}`)
+ .then((response) => response.json())
+ .then((data) => setCityData(data))
+ .catch(() => setCityData(null));
+ };
+
+ const onChange = () => {
+ const zip = document.getElementById("zipcode");
+ fetchZipcodes(zip.value);
+ };
+
+ return (
+
+ );
}
function App() {
+ const [cityData, setCityData] = useState();
+
return (
Zip Code Search
-
-
-
-
+
+
+ {cityData && cityData.length > 0
+ ? cityData.map((city, index) => )
+ : null}