Trying to fetch data from API but could not able to as I am new to reactjs and having trouble in
fetching data for making a project of cryptocurrency tracker.

How can I use axios to fetch data and also want to know how to handle error using try catch method

Code:

```js
import React, { Component } from "react";
import axios from "axios";

class App extends Component {
    getData = () => {
        axios({
            method: "GET",
            url: "https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest",
            qs: {
                start: "1",
                limit: "100",
                convert: "USD"
            },
            headers: {
                "Content-Type": "application/json",
                "X-CMC_PRO_API_KEY": "api_key"
            },
            json: true
        }).then((response) => {
            console.log(response);
        });
    };

    componentWillMount() {
        this.getData();
    }

    render() {
        return <div>hello asfa</div>;
    }
}

```

Getting the following error:-

> 
> Uncaught error (in promise) - at createError (createError.js:16)
> at XMLHttpRequest.handleError
> 
> 
>