I'm pulling data from an API using a simple fetch call. The API call pulls an object and I'm using JSON.Stringify to extract the data in readable format, however, I just want the number that it produces. Here is an excerpt from the API
{
  "confirmed": {
    "value": 24637475,
    "detail": "https://covid19.mathdro.id/api/confirmed"
  },
  "recovered": {
    "value": 16108272,
    "detail": "https://covid19.mathdro.id/api/recovered"
  },
I'm just trying to get the confirmed.value
here is my current code
import React, { useState, useEffect } from "react";
const Cards = () => {
    const [hasError, setErrors] = useState(false);
    const [data, setData] = useState({});
    async function fetchData() {
        const res = await fetch("https://covid19.mathdro.id/api");
        res
            .json()
            .then(res => setData(res))
            .catch(err => setErrors(err));
    }
    useEffect(() => {
        fetchData();
    }, []);
    return (
        <div>
            <span>{JSON.stringify(data.confirmed)}</span>
            <hr />
            <span>Has error: {JSON.stringify(hasError)}</span>
        </div>
    );
};
export default Cards;
