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

react-fetch-hook

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-fetch-hook - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

dist/flow-tests/useFetch.flow-test.js

2

package.json
{
"name": "react-fetch-hook",
"version": "1.1.0",
"version": "1.2.0",
"description": "React fetch hook",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

# react-fetch-hook
[![Build Status](https://travis-ci.org/ilyalesik/react-fetch-hook.svg?branch=master)](https://travis-ci.org/ilyalesik/react-fetch-hook)
[![npm version](https://img.shields.io/npm/v/react-fetch-hook.svg)](https://www.npmjs.com/package/react-fetch-hook)
[![npm downloads](https://img.shields.io/npm/dt/react-fetch-hook.svg)](https://www.npmjs.com/package/react-fetch-hook)
React hook, which allows you to conveniently work with *fetch*. Good Flow support.

@@ -4,0 +8,0 @@

// @flow
import { usePromise } from "./usePromise";
type TUseFetchResult = {
data: ?mixed,
type TUseFetchResult<T> = {
data: ?T,
isLoading: boolean,

@@ -10,6 +10,6 @@ error: mixed

export function useFetch(
export function useFetch<T>(
path: RequestInfo,
options?: { ...RequestOptions, formatter?: Response => Promise<mixed> }
): TUseFetchResult {
options?: { ...RequestOptions, formatter?: Response => Promise<T> }
): TUseFetchResult<T> {
const defaultFormatter = response => response.json();

@@ -22,6 +22,6 @@ const fetchInstance = formatter => (path, options) => {

return usePromise(fetchInstance(formatter), path, fetchOptions);
return usePromise((fetchInstance(formatter): any), path, fetchOptions);
} else {
return usePromise(fetchInstance(), path);
return usePromise((fetchInstance(): any), path);
}
}

Sorry, the diff of this file is not supported yet

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