Third-Party Libraries in React

Learn about a third party library "axios", what it is and how it works?

We'll cover the following

We have learned about the native fetch API to complete requests to the Hacker News API, which the browser provides. Not all browsers support this, however, especially the older ones. Also, once you start testing your application in a headless browser environment, issues can arise with the fetch API. There are a couple of ways to make fetch work in older browsers (polyfills) and in tests (isomorphic fetch), but these concepts are a bit off-task for the purpose of this learning experience.

One alternative is to substitute the native fetch API with a stable library like axios, which performs asynchronous requests to remote APIs. In this section, we will discover how to substitute a library–a native API of the browser in this case–with another library from the npm registry. First, install axios on the command line:

Get hands-on with 1200+ tech skills courses.