How to use the react-fetching-library.usePaginatedQuery function in react-fetching-library

To help you get started, we’ve selected a few react-fetching-library examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marcin-piela / react-fetching-library / examples / simple-app / src / App.tsx View on Github external
const TestComponent = () => {
  const { response, error, loading } = useQuery(exampleAction());
  const { fetch, response: paginatedResponse } = usePaginatedQuery(
    examplePaginatedQuery,
    [1],
  );
  const [page, setPage] = useState(1);

  return (
    <span>
      {error &amp;&amp; 'error'}
      {loading &amp;&amp; 'loading'}
      {response &amp;&amp; 'response'}

      {paginatedResponse &amp;&amp; paginatedResponse.length}

      <button> {
          fetch([page + 1]);</button></span>

react-fetching-library

Simple and powerful API client for react. Use hooks or FACC's to fetch data in easy way. No dependencies! Just react under the hood.

MIT
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis