Skip to content

axios-react-hooks is a custom hooks library for consuming restful APIs using axios

Notifications You must be signed in to change notification settings

aldabbasy/axios-react-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

axios-react-hooks

axios-react-hooks is a custom hooks library for consuming restful APIs using axios

How to Use

there is two hooks in this library:

  • useAxiosGet which can be used as below for GET requests:
const {data, loading, refetch} = useAxiosGet(
  {
    endpoint: 'your/api/endpoint/here',
    headers: {'header-name': 'header-value'}
  }
);
  • useAxiosPost which can be used as below for POST requests:
const [sendRequest, {data, loading}] = useAxiosPost(
  {
    endpoint: 'your/api/endpoint/here', 
    headers: {'header-name': 'header-value'}
  }
);
...
sendRequest(body);

author: allaith aldababseh

About

axios-react-hooks is a custom hooks library for consuming restful APIs using axios

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published