Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created January 6, 2020 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BetterProgramming/220bdc705670fc1f65d44154be4e2313 to your computer and use it in GitHub Desktop.
Save BetterProgramming/220bdc705670fc1f65d44154be4e2313 to your computer and use it in GitHub Desktop.
import React, { useEffect, useState } from "react";
import "./App.css";
const APIURL = "https://api.coingecko.com/api/v3/";
function App() {
const startDate = "1/1/2016";
const endDate = "1/1/2020";
const freqInDays = 30;
const amountToInvest = 200;
const [coinData, setCoinData] = useState([]);
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(false);
const getCoinData = async (startDate, endDate) => {
setIsLoading(true);
const url = ""; // TODO
try {
const coinResponse = await fetch(url);
const data = await coinResponse.json();
setCoinData(data);
setError(false);
setIsLoading(false);
} catch (e) {
setIsLoading(false);
setError(e);
}
};
return (
<div className="App">
<h1>Bitcoin</h1>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment