function App() { const [product, setProduct] = useState([]); useEffect(() => { const apiURL = "https://fakestoreapi.com/products"; fetch(apiURL) .then((response) => { if (!response.ok) { throw new Error("No Response from the API"); } return response.json(); }) .then((data) => { setProduct(data); }) .catch((error) => { console.error("Not Feteched"); }); }, []); return ( <div> <ul> {product.map((product) => ( <li>{product.title}</li> ))} </ul> </div> ); } export default App;