@am-hooks/use-axios

1.0.0 • Public • Published

useAxios

HTTP requests client axios 을 위한 wrapper 같은 것

Installation

yarn

yarn add @am-hooks/use-axios

npm

npm i @am-hooks/use-axios

Usage

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

const App = () => {
  const { loading, error, data, refetch } = useAxios({
    url: "https://yts.mx/api/v2/list_movies.json"
  });
  console.log(
    `loading = ${loading},\n error = ${error},\n data = ${JSON.stringify(data)}`
  );

  return (
    <>
      <div>{data && data.status}</div>
      <div>{loading && "Loading..."}</div>
      <button onClick={refetch}>Refetch</button>
    </>
  )
}



Readme

Keywords

Package Sidebar

Install

npm i @am-hooks/use-axios

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

2.27 kB

Total Files

4

Last publish

Collaborators

  • wam-6577