I have an Array of orders and want to loop inside the array and call an async function to check each order and then render the array inside the dom.dow is my code
I try to create an array outside of mapping and push valid orders to the array but when I log the array its empty
renderTrades = () => {
const { trades } = this.props;
const contractWrappers = new ContractWrappers(web3Wrapper._provider, { networkId: KOVAN_NETWORK_ID });
const _trade = [];
trades.map((trade, index) => {
contractWrappers.exchange.getOrderInfoAsync(trade.order)
.then((val) => {
if (val.orderStatus == 5) {
_trade.push(<TradeRow0x key={index} />);
}
});
});
return _trade;
};
I want to push valid orders to the array and render it into the dom