@hoooks/use-axios

1.0.3 • Public • Published

@hoooks/use-axios

Get external data and reload function with options.

Installation

yarn

yarn add @hoooks/use-axios

npm

npm i @hoooks/use-axios

Usage

import React from "react";
import useAxios from "@hoooks/use-axios";

export default function App() {
  const { isLoading, data, error, reload } = useAxios({
      url: "https://something.you.need.to.get"
  });
  return (
      <>
        <h1>{isLoading ? "loading..." : "put your logic here"}</h1>
        <button onClick={reload}>reload</button>
      </>
  );
}

Return

Return Type Description
isLoading, data, error, reload function Object An object containing isLoading, data, error, reload function

Readme

Keywords

Package Sidebar

Install

npm i @hoooks/use-axios

Weekly Downloads

3

Version

1.0.3

License

MIT

Unpacked Size

2.32 kB

Total Files

4

Last publish

Collaborators

  • aidenjung