UNPKG

@ashraflabs/use-api

Version:

A simple and powerful custom React hook (useApi) that simplifies API requests with automatic loading and error states. Ideal for clean and maintainable data fetching in React components.

9 lines (8 loc) 298 B
export default class FetchError extends Error { constructor(message, response = null, status = null) { super(message); this.name = 'FetchError'; this.response = response; // Fetch Response object or null this.status = status; // HTTP status code or null } }