Create a reusable React component that handles dynamic state changes and handles API error states gracefully.