A React hook for making isomorphic HTTP requests with built-in caching, GraphQL support, and request/response interceptors.
useFetch is a React hook for making isomorphic HTTP requests that works in both client and server environments. It simplifies data fetching by providing built-in state management, caching, GraphQL support, and request lifecycle controls. The hook addresses common challenges like handling loading states, errors, retries, and request cancellation in React applications.
React developers building applications that require data fetching from APIs, especially those needing SSR compatibility, GraphQL integration, or advanced request features like caching and interceptors.
Developers choose useFetch because it consolidates multiple data-fetching concerns into a single, well-designed hook with a rich feature set. Its isomorphic nature, GraphQL support, and extensive configuration options make it a versatile alternative to combining separate libraries for fetching, caching, and state management.
🐶 React hook for making isomorphic http requests
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works seamlessly in both browser and server environments with SSR, as demonstrated by examples for Next.js and server-side rendering in the README.
Provides dedicated useQuery and useMutation hooks for GraphQL operations, reducing the need for additional libraries like Apollo Client.
Includes built-in caching with policies and retry logic with custom delays, helping minimize network requests and handle unreliable connections.
Automatically aborts pending requests on component unmount and offers timeout handling, preventing memory leaks and improving stability.
Suspense integration is marked as experimental in the README, which may lead to instability or breaking changes in future releases.
Currently only supports 'cache-first' or 'no-cache' policies, lacking the full range of options found in more mature libraries like Apollo Client.
Persistent caching is only available in browser environments and not yet supported in React Native, as noted in the todos section of the README.