@jacob-hooks/use-axios

1.0.19 • Public • Published

@jacob-hooks/use-axios

React Hook to send HTTP request and get data from URL

install

  • yarn

$ yarn add @jacob-hooks/use-axios

  • npm

$ npm i @jacob-hooks/use-axios

Usage

import useAxios from "@jacob-hooks/use-axios";

const App = () => {
  const { loading, data, refetch } = useAxios({
    url: "https://yts.mx/api/v2/list_movies.json",
  });
  return (
    <>
      <div className="App">
        <h1>{data && data.status}</h1>
        <h2>{loading && "Loading"}</h2>
        <button onClick={refetch}>Refetch</button>
      </div>
    </>
  );
};

export default App;

Package Sidebar

Install

npm i @jacob-hooks/use-axios

Weekly Downloads

1

Version

1.0.19

License

MIT

Unpacked Size

3.97 kB

Total Files

6

Last publish

Collaborators

  • jacobko