{loading ? (
<strong>Loading...</strong>
) : (
<ul>
{coins.map((coin) => (
<li>
{coin.name} {coin.symbol} :{" "}
{Math.round((myMoney / coin.quotes.USD.price) * 100) / 100}
{" "}
{coin.symbol}
{" can buy!"}
</li>
))}
</ul>
)}
这是为React beignner项目,
现在这个来源使所有硬币对象返回。
我已经找到了如何使用javascript语句。但是找不到路。
coin
正在使用其他网站api(https://api.coinpaprika.com/v1/tickers)
我该如何解决这个问题?
您可以轻松使用
let startIndex=0;
let endIndex=50;
let coins50 = coins.slice(startIndex, endIndex)
此外,必须定义分页以显示其余数据注意:您必须将数据保存到组件状态