Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-use-http

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-http

- Code Sandbox Example

  • 0.1.13
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc