1.0.0 • Published 5 years ago

@hookeasy/use-axios v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@hookeasy/use-use-axios

React Hook to update your useAxios event

install

npm i @hookeasy/use-useAxios

or

yarn add @hookeasy/use-useAxios

example

import React from "react";
import ReactDOM from "react-dom";
import useAxios from "@hookeasy/use-axios";

const App = () => {
  const { loading, data, error, refetch } = useAxios({
    url: "https://yts.lt/api/v2/list_movies.json"
  });

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

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);