Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@goldenjayr/use-fetch

goldenjayr10MIT0.1.3TypeScript support: included

This hook uses axios under the hood. > This hook makes good use of React Suspense

react hook, react-hook, use, isomorphic, http, fetch, hook, react, useFetch, fetch, request, axios, react-use-fetch, react-fetch-hook, use-fetch, suspense, fetch data, usefetch hook, react-hooks-fetch, react usefetch, react hooks tutorial, react-cache, react custom hooks, react-usefetch, react hooks async, react suspense, use hooks, react usefetch hook, fetch-suspense, async hook react, react-hooks-fetch, react hooks usefetch, use fetch hook, react fetch hook, graphql, mutation, query, useAxios, use-axios, use-superagent, superagent, apollo, useGraphQL, use-graphql, use-fetch, promise api, useFetchPromise, usefetch suspense, goldenjayr, dongje, @goldenjayr/use-fetch, @goldenjayr/usefetch, goldenjayr usefetch, Jay-R Joseph Gabunada, Jayr gabunada, jayr, gabunada, joseph

readme

Use Fetch by @goldenjayr

This hook uses axios under the hood. This hook makes good use of React Suspense

    import useFetch from '@goldenjayr/use-fetch'
    import { Suspense } from 'react'

    function Todos() {
      const options = {} // these options accept all native `axios` options
      // the last argument below [] means it will fire onMount (GET by default)
      const data = useFetch({ url: 'https://example.com/todos', options })
      return (
        <>
          {data}
        </>
      )
    }


    function App() {
      return (
        // you need to wrap your component in suspense
        <Suspense>
          <Todo />
        </Suspense>
      )
    }