Add usage example with Axios
See original GitHub issueAxios is a popular alternative to fetch. We should provide document how to use React Async with Axios, including Axios’ cancellation mechanism.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Axios tutorial - GET/POST requests in JavaScript with Axios
In the first example, we create a simple GET request. We use callbacks. ... const axios = require('axios'); axios.get('http://webcode.me').then( ...
Read more >Making HTTP requests with Axios - CircleCI
Axios is a promise-based HTTP library that lets developers make requests to either their own or a third-party server to fetch data.
Read more >How to make HTTP requests with Axios - LogRocket Blog
In this tutorial, we'll demonstrate how to make HTTP requests using Axios with clear examples, including how to make an Axios POST request...
Read more >How To Use Axios with React - DigitalOcean
In this article, you will see examples of how to use Axios to access the popular JSON Placeholder API within a React application....
Read more >Complete Guide to Axios HTTP Client - Reflectoring
In this article, we will understand Axios and use its capabilities to make different types of REST API calls from JavaScript applications.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

That’s certainly possible. It would be very similar to how
useFetchis implemented, but with Axios instead of fetch. It won’t be part of React Async though, because I don’t want to add a dependency. Adding it as an example is fine though 👍Maybe you can pick that up? Here’s the outline:
This is untested, but it should be close enough.
The
onCancelcallback was recently added in v7.0.2.An extension like react-async-axios is certainly possible, but not really necessary I think. With
onCancel, it would be something like this: