A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/soroushchehresa/axios-react below:

soroushchehresa/axios-react: 🌐 HTTP client component for React based on Axios

HTTP client component for React with child function callback to create async requests in render based on Axios.

Yarn:

npm:

Online Playground


import React from 'react';
import Request from 'axios-react';

const Demo = () => (
  <Request
    config={{
      method: 'get',
      url: 'https://jsonplaceholder.typicode.com/todos/1',
    }}
  >
    {({ loading, response, error, refetch, networkStatus }) => (
      <div>
          {networkStatus && <span>{networkStatus}</span>}
          {loading && <span>Loading...</span>}
          {error && <span>{error.response.data}</span>}
          {response && <h3>{response.data.title}</h3>}
          <button onClick={refetch}>Refetch!</button>
      </div>
    )}
  </Request>
);

Name Type Description loading boolean Request loading. response object The response for a request contains the Axios response schema. error object The error for a request. refetch function Refetch method for a request. networkStatus string Network Connection Status.
Name Type Default value Options Description config object None Axios request config options Config options for making requests. skip boolean false true or false Disable sending requests when mounting the component.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4