@fishdeveloper/usefetch
v1.1.0
Published
### Features
Readme
useFetch
Features
- Make XMLHttpRequests from the browser
- Automatic transforms for JSON data
Installing
Package manager
Using npm:
$ npm install @fishdeveloper/usefetchUsing yarn:
$ yarn add @fishdeveloper/usefetchUsing pnpm:
$ pnpm add @fishdeveloper/usefetchOnce the package is installed, you can import the library using import approach:
import { useFetch } from "@fishdeveloper/usefetch";Example
import { useFetch } from "@fishdeveloper/usefetch";
useFetch("todos/1", {
baseURL: "https://jsonplaceholder.typicode.com",
headers: { "X-Custom-Header": "foobar" },
}).then((res) => console.log(res));
// output = {
// data: {
// "userId": 1,
// "id": 1,
// "title": "delectus aut autem",
// "completed": false
// }
// }