@ian_test_nooks/use-axios

1.0.1 • Public • Published

@ian_test_nooks/use-axios

React Hook to check axios data loading / complete and get data

npm i @ian_test_nooks/use-axios

const { loading, error, data, refetch } = useAxios({ url: return JSON URL });

import useAxios from "@ian_test_nooks/use-axios";

const App = () => {
  const { loading, error, data, refetch } = useAxios({
    url: "https://yts-proxy.nomadcoders1.now.sh/list_movies.json?sort_by=rating"
  });

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

Readme

Keywords

Package Sidebar

Install

npm i @ian_test_nooks/use-axios

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

2.3 kB

Total Files

4

Last publish

Collaborators

  • iian