react-http-hook-use-fetch
v2.0.2
Published
React hook to fetch data over http using native fetch method
Downloads
3
Readme
react-http-hook-use-fetch
React hook to fetch data over http using native fetch method
How to use
import { useFetch } from 'react-http-hook-use-fetch'
Then, in your function component:
const { loading, data } = useFetch( url );
or
const { loading, data } = useFetch( url, { headerKey: headerValue }, 'POST', { key: value } );
Editor Configuration
- Editor of your preference. I used some VSCode specific config in .vscode folder and recommend plugins for enhanced experience.
Recommended VSCode Extensions:
- Prettier (Official) - Code formatter
- ESLint (Official) - Real time JS syntax validation
Technologies Used
- React 18 (Hooks)
- Typescript + ESM
- Rollup.js
- Yarn
- Prettier + ESlint
- Generated using boilerplate https://github.com/n10l/react-lib-boilerplate
Available Scripts
In the project directory, you can run:
yarn build
To build the project