Registry / testing / react-fetch

react-fetch

JSON →
library0.0.9jsnpmunverified

A React component for fetching data from an API and rendering the result. This package (v0.0.9) provides a <Fetch> component that takes a URL and options and renders based on the fetch state (loading, error, fetched). It uses a render prop pattern and works with React 0.14+. The package is extremely minimal but has been abandoned since 2016 with no updates; the pattern is often mocked using hooks like useFetch. It is not recommended for new projects due to lack of maintenance and the render prop approach being outdated.

npm install react-fetch
INSTALL
IMPORT
SIG · REACT-FETCH
R
react-fetch
testingjavascriptv0.0.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Fetch
import Fetch from 'react-fetch'
import { Fetch } from 'react-fetch'
This package uses a default export, not a named export. Named import will result in undefined.
Fetch (CommonJS)
const Fetch = require('react-fetch')
const { Fetch } = require('react-fetch')
CommonJS require returns the default export directly.

Shows basic usage of the Fetch component with a render prop for loading, error, and success states.

import React from 'react'; import Fetch from 'react-fetch'; function App() { return ( <Fetch url="https://api.example.com/data"> {(data, error, loading) => { if (loading) return <p>Loading...</p>; if (error) return <p>Error: {error.message}</p>; return <p>Data: {JSON.stringify(data)}</p>; }} </Fetch> ); } export default App;
Debug
Known issues
deprecatedPackage has not been updated since 2016. Use modern fetch hooks like useFetch or React Query instead.
fix
Replace with @tanstack/react-query or swr.
affects: 0.0.9
Errors
Common errors & fixes
Uncaught TypeError: Cannot read property 'fetch' of undefined
Importing as named export instead of default import.
fix
Use 'import Fetch from 'react-fetch'' instead of 'import { Fetch } from 'react-fetch''.
Uncaught TypeError: Fetch is not a constructor
Using new Fetch(...) instead of <Fetch .../> as a component.
fix
Use it as a JSX component: <Fetch url='...'>...</Fetch>
Upgrade
Version history
0.0.9latest on npm
Audit
Dependencies
reactrequiredpeer dependency for React components
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
react-fetch — npm install react-fetch · libregistry