import { useEffect, useState } from "react";
function App() {
const [loding, setLoding] = useState(true);
const [coins, setCoins] = useState([]);
useEffect(() => {
fetch("https://api.coinpaprika.com/v1/tickers")
.then((response) => response.json())
.then((json) => setCoins(json));
setLoding(false);
}, []);
return (
<div className="App">
<h1>The Coins! {loding ? "" : `(${coins.length})`}</h1>
{loding ? (
<strong>Loding...</strong>
) : (
<select>
{coins.map((coin) => (
<option value={coin.quotes.USD.price}>
{coin.name} ({coin.symbol}): ${coin.quotes.USD.price} USD
</option>
))}
</select>
)}
</div>
);
}
export default App;
https://coinpaprika.com/ 코인 파프리카의 api 자료를 활용해 제작하였습니다.
Cryptocurrency Research Platform | Coin Market Capitalizations | Top 100 Cryptocurrencies | Coinpaprika
Coinpaprika is a Cryptocurrency Market Research Platform. We deliver data from over 25 000 Cryptocurrency Markets. Check the latest Cryptocurrency Prices, Graphs, Cryptocurrency Exchanges ATH, Developer Teams, Community Statistics, Coin Market Caps.
coinpaprika.com
노마드 코더 Nomad Coders
코딩은 진짜를 만들어보는거야!. 실제 구현되어 있는 서비스를 한땀 한땀 따라 만들면서 코딩을 배우세요!
nomadcoders.co
'프로그래밍 > ReactJS' 카테고리의 다른 글
react bootstrap 오류 cannot be invoked without 'new' (0) | 2023.09.14 |
---|---|
usestate (0) | 2023.09.11 |
react로 todolist 만들기 (0) | 2023.09.07 |
react)useState 기초 버튼 클릭할 때마다 카운트하기 (0) | 2023.08.30 |
React 컴포넌트 (0) | 2023.08.22 |