diff --git a/src/components/Repairs.js b/src/components/Repairs.js index c69fe2f..9a726a4 100644 --- a/src/components/Repairs.js +++ b/src/components/Repairs.js @@ -1,19 +1,24 @@ +/* imports React library */ import React from "react" +import { useEffect, useState } from "react" +/* State is stored directly in the application file */ +/* const [customers, assignCustomers] is called a deconstruction array */ export const Repairs = () => { + /* assignCustomers holds an array of the assigned customers a dependancy/subset of customers. i.e. this is your state variable */ const [customers, assignCustomers] = useState([]) useEffect( () => { fetch("http://localhost:8088/customers") .then(res => res.json()) - .then(customerAr(customers) customerArray: any - setCustomers(customers) => { } + .then((customers) => { + assignCustomers(customers) } ) - }, + }, [] ) - +/* JSX, returns whatever HTML code you want rendered to the DOM */ return ( <>