import React from "react"; import { useState, useEffect } from "react"; import { Question, Chevron } from "./assets"; const Analytics: React.FC = () => { const [viewCount, setViewCount] = useState(0); const [clickCount, setClickCount] = useState(0); useEffect(() => { fetch("https://dog.ceo/api/breeds/list/all") // TODO: Change to '/api/editor/links' .then((results) => results.json()) .then((data) => { console.log("Success:", data); // TODO: Assign the correct values here: // setViewCount(data.views); // setClickCount(data.clicks); }) .catch((error) => { console.error("Error:", error); }); }, []); return (
Lifetime Analytics:

Views:

{viewCount || "-"}

Clicks:

{clickCount || "-"}

{Question}
{Chevron}
); }; export default Analytics;