🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-usefetcher

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-usefetcher

- Code Sandbox Example

0.1.12
latest
npm
Version published
Weekly downloads
2
-50%
Maintainers
1
Weekly downloads
 
Created
Source

useFetch

🐶 A React hook for making http requests

Need to fetch some data? Try this one out.

Examples

Installation

yarn add react-usefetcher

Usage

Stateless

import useFetch from 'react-usefetch'

function App() {
  const [data, loading, error] = useFetch('https://example.com')
  return error ? (
    'Error!'
  ) : loading ? (
    'Loading!'
  ) : (
    <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)

FAQs

Package last updated on 11 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts