Need help with use-data-api?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

224 Stars 22 Forks MIT License 8 Commits 1 Opened issues


Custom hook for React Components to fetch data from an API.

Services available


Need anything else?

Contributors list

useDataApi React Hook

Build Status Slack Greenkeeper badge NPM

Custom hook for React Components to fetch data from an API. Read more about it..

Example over here.


npm install use-data-api


Accepts as first argument an endpoint URL and as second argument an initial state for

. It returns as first item in an array an object which holds the data, isLoading and isError states, and the actual function to fetch the data (e.g. on a button click).
import React from 'react';

import useDataApi from 'use-data-api';

const AnyComponent = props => { const [{ data, isLoading, isError }, doFetch] = useDataApi( '', null, );

... };


  • git clone [email protected]:the-road-to-learn-react/use-data-api.git
  • cd use-data-api
  • npm install
  • npm run test


We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.