0.1.21 • Published 5 years ago

use-usefetcher v0.1.21

Weekly downloads
29
License
-
Repository
-
Last release
5 years ago

Examples

  • Code Sandbox Example

Installation

yarn add use-http

Usage

Stateless

import useFetch from 'use-http'

function App() {
  const [data, loading, error] = useFetch('https://example.com')
  
  if (error) {
    return 'Error!'
  }
  
  if (loading) {
    return 'Loading!'
  }
  
  return (
    <code>
      <pre>{data}</pre>
    </code>
  )
}

Options

OptionDescription
optionsThis is exactly what you would pass to the normal js fetch

Option Usage

const options = {
  method: 'POST'
}
const [data, loading, error] = useFetch(url, options)
0.1.21

5 years ago

0.1.20

5 years ago

0.1.19

5 years ago

0.1.18

5 years ago

0.1.17

5 years ago

0.1.16

5 years ago

0.1.13

5 years ago