Archived
added file structure and components
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
lastPurchaseID integer
|
||||
locationIDLastPurchasedFrom integer
|
||||
mostPurchasedLocationID integer
|
||||
productTypesLastPurchased integer
|
||||
productsIDLastPurchased integer
|
||||
productsMostPurchasedID integer
|
||||
@@ -0,0 +1,30 @@
|
||||
import React, {
|
||||
useEffect,
|
||||
useState
|
||||
} from "react";
|
||||
|
||||
export const LocationsList = () => {
|
||||
const [locations, setLocationList] = useState([])
|
||||
|
||||
useEffect(
|
||||
() => {
|
||||
fetch("http://localhost:8088/locations")
|
||||
.then(res => res.json())
|
||||
.then(setLocationList)
|
||||
},
|
||||
[]
|
||||
)
|
||||
return (
|
||||
<>
|
||||
|
||||
{
|
||||
locations.map(
|
||||
(locationObject) => {
|
||||
return <p key={`locations--${locationObject.id}`}> {locationObject.name}</p>
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user