Use the "Verify Solution" button to get AI feedback on your React code.
In this task, you are required to implement a React component that fetches data from a simulated API endpoint. The component should gracefully handle different states:
Loading State: Display a 'Loading...' message while data is being fetched.
Data Display State: Once data is successfully fetched, display it.
Error State: If an error occurs during fetching (e.g., network error, API returns a non-OK status code), display an appropriate error message.
You must ensure proper cleanup to prevent memory leaks or state updates on unmounted components, a common pitfall in asynchronous operations. Pay close attention to useEffect's dependencies and error handling strategies.