iKo*_*ode 6 reactjs react-starter-kit
我从react-starter-kit项目中创建了一个新路由,它对一些数据进行异步提取,然后呈现它,但是一秒钟之后页面重新加载,并显示"找不到页面 - 抱歉,但页面是你的"试图查看不存在".
在控制台中,我看到 - "警告:文本内容不匹配.服务器:"余额"客户端:"找不到页面"
async function action() {
let bittrex = new ccxt.bittrex ({
'apiKey': '',
'secret': ''
})
try {
// fetch account balance from the exchange
let bittrexBalance = await bittrex.fetchBalance ()
/**** commenting above and uncommenting this block stops it from happening....
let bittrexBalance = {};
bittrexBalance.info= [];
let currency = {};
currency.Currency = "BTC";
currency.Value=999;
// output the result
bittrexBalance.info.push(currency);*/
console.log ('balance', bittrexBalance)
let balances = [];
balances.push(bittrexBalance)
return {
title: "Balances",
component: (
<Layout>
<Balances balances={balances} />
</Layout>
),
};
} catch (e) {
console.log('SOME sort of error', e);
}
Run Code Online (Sandbox Code Playgroud)
有谁知道这可能是什么?
编辑添加,我现在意识到,如果我禁用Javascript一切正常...
这是我到目前为止找到的唯一线索......我不明白为什么它已经加载后重新加载页面...
页面未找到错误来自它:
第二次捕获(e)...我怀疑ccxt库中发生了一些事情,但问题实际上是第二次调用它,因为页面以某种方式重新加载......
看来您必须await bittrex.loadProducts()在获取余额之前致电。
编辑:似乎也已被github 上本期
的更多信息bittrex.loadProducts()重命名bittrex.loadMarkets()
| 归档时间: |
|
| 查看次数: |
161 次 |
| 最近记录: |