diff --git a/src/App.tsx b/src/App.tsx index 69f1e5c..f953c84 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -295,7 +295,7 @@ function App() { $ - 250 + {balance || 0}

@@ -317,10 +317,9 @@ function App() {
{/* = ({ currency, symbol, valueSpot, - valueFiat, }) => { + const [valueFiat, setValueFiat] = useState(0); + + const getFiatValue = async () => { + const response = await fetch( + `https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd` + ); + const data = await response.json(); + setValueFiat(Number((data.ethereum.usd * valueSpot).toFixed(2))); + }; + + useEffect(() => { + getFiatValue(); + }, []); + return (
- +

{currency}