diff --git a/src/App.tsx b/src/App.tsx index 1a8d049..f467f90 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,6 @@ import { Routes, Route, Outlet, Link } from "react-router-dom"; import ProductPage from './pages/Product'; +import ProductList from './pages/ProductList'; function App() { @@ -8,6 +9,7 @@ function App() { } /> } /> + } /> diff --git a/src/pages/ProductList.tsx b/src/pages/ProductList.tsx new file mode 100644 index 0000000..f1c3a25 --- /dev/null +++ b/src/pages/ProductList.tsx @@ -0,0 +1,22 @@ +import React, { useEffect } from 'react' + +const BASE_URL = 'https://3dprinter-web-api.benhalverson.workers.dev/list' + +const getData = async () => { + const response = await fetch(BASE_URL) + const data = await response.json() + console.log('data', data) + return data +} + + +function ProductList() { +useEffect(() => { + getData() +}, []) + return ( +
ProductList
+ ) +} + +export default ProductList \ No newline at end of file