Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fetch-hook

Installation

npm install fetch-hook

OR

yarn add fetch-hook

Quick Start

Basic Usage

import useFetchJson from 'fetch-hook';

function App() {
  const [{ isLoading, error, data }] = useFetchJson(
    'https://swapi.co/api/people',
    {
      method: 'GET'
    }
  );

  if (isLoading) {
    return <div className='App'>En chargement ...</div>;
  }
  return (
    <div className='App'>
      {data &&
        data.results &&
        data.results.map(res => {
          return <p>{res.name}</p>;
        })}
    </div>
  );
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages