To display all hotels fetched from the backend and enable users to delete any hotel directly from the frontend using integrated APIs.
Use a custom React hook useFetch.jsx to fetch hotel data from /api/hotels. Each displayed hotel will include a Delete button that sends a DELETE request to /api/hotels/:id, removing the hotel from the database and updating the UI list.
- Fetch and render all hotels dynamically using reusable hook.
- Delete selected hotel and refresh the hotel list instantly.
- Show success message upon successful deletion.
- Handle loading and error states gracefully.
- Implementation of DELETE method integration with backend APIs.
- Efficient state update post-deletion in React.
- Improved understanding of frontend-backend CRUD synchronization.