The table is creating the fields that are seeing in the json url PGX,MORL,EMLC,GYLD,BSJF,MONY It sees 6 symbols and it creates 6 cells. 1 cell for each symbol It knows the are 6 symbols but it does not want to display the values
Where is the issue? Please help
import React, { useState, useEffect } from "react";
import BootstrapTable from 'react-bootstrap-table-next';
const App = props => {
const [hasError, setErrors] = useState(false);
const [value, setValues] = useState({});
useEffect(() => {
async function fetchData() {
const res = await fetch("https://sandbox.iexapis.com/stable/stock/market/batch?symbols=PGX,MORL,EMLC,GYLD,BSJF,MONY&types=stats,quote&token=");
res
.json()
.then(res => setValues(res))
.catch(err => setErrors(err));
}
console.log(quote);
fetchData();
}, []);
const quote = Object.keys(value).map(i => value[i]);
const columns = [
{
dataField: 'id',
text: 'Id'
}, {
dataField: 'Symbol',
text: 'Symbol'
}, {
dataField: 'price',
text: 'Price'
}, {
dataField: 'CompanyName',
text: 'Company Name'
}];
return (
<div>
<BootstrapTable keyField= "id" data={quote} columns={columns} />
</div>
);
}
export default App;