@ahmadmubarak98/use-fetch
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

@ahmadmubarak98/use-fetch

Introduction

Welcome to @ahmadmubarak98/use-fetch, a lightweight and powerful React hook library designed to simplify fetching data within your React applications. This custom hook leverages the modern React features to make HTTP requests more straightforward and efficient, while also handling cache, loading states and errors gracefully.

Installation

npm install @ahmadmubarak98/use-fetch

Quick Start

import { useFetch } from '@ahmadmubarak98/use-fetch'

function ExampleComponent() {
  const { data, error, isLoading } = useFetch({ url: 'https://dummyjson.com/users/1' })

  if (error) return <div>failed to load</div>
  if (isLoading) return <div>loading...</div>
  return <div>hello {data.name}!</div>
}

License

The MIT License.

Dependencies (0)

    Dev Dependencies (31)

    Package Sidebar

    Install

    npm i @ahmadmubarak98/use-fetch

    Weekly Downloads

    243

    Version

    1.0.8

    License

    MIT

    Unpacked Size

    38.5 kB

    Total Files

    15

    Last publish

    Collaborators

    • ahmadmubarak98