Changeset 2518b3a for my-react-app/src/components/RestaurantContext.js
- Timestamp:
- 05/02/25 00:37:10 (2 weeks ago)
- Branches:
- main
- Children:
- c44c5ed
- Parents:
- e15e8d9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
my-react-app/src/components/RestaurantContext.js
re15e8d9 r2518b3a 8 8 9 9 useEffect(() => { 10 if (restaurants.length > 0) return; 10 11 const fetchRestaurants = async () => { 11 12 try { 12 13 const response = await axios.get('http://localhost:8081/api/restaurants'); 14 console.log("Fetched once", response.data); 13 15 setRestaurants(response.data); 14 16 } catch (error) { … … 16 18 } 17 19 }; 18 19 20 fetchRestaurants(); 20 21 }, []);
Note:
See TracChangeset
for help on using the changeset viewer.