react-fetch-hook
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "react-fetch-hook", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "React fetch hook", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
# react-fetch-hook | ||
React hook, which allows you to conveniently work with *fetch*. Good Flow support. | ||
## Installation | ||
@@ -37,1 +39,20 @@ | ||
You can pass any *fetch* options: | ||
```javascript | ||
const { isLoading, data } = useFetch("https://swapi.co/api/people/1", { | ||
method: "get", | ||
headers: { | ||
Accept: "application/json, application/xml, text/plain, text/html, *.*", | ||
"Content-Type": "application/json; charset=utf-8" | ||
} | ||
}); | ||
``` | ||
You can pass *formatter* prop for using custom formatter function. Default is used *response => response.json()* formatter. | ||
```javascript | ||
const { isLoading, data } = useFetch("https://swapi.co/api/people/1", { | ||
formatter: (response) => response.text() | ||
}); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8799
58