So I've got both chunks of code written for both the API request, as well as the grid rendering, however I'm confused as to how to combine the two in a react environment. Any suggestions?
(this is using react-axios)
<Request
method="get", /* get, delete, head, post, put and patch - required */
url="http://coincap.io/front", /* url endpoint to be requested - required */
debounce={50} /* minimum time between requests events - optional */
onSuccess={(response)=>{}} /* called on success of axios request - optional */
onError=(error)=>{} /* called on error of axios request - optional */
/>
I'm looking to remove this hardcoded data, and render the grid with the data pulled from the api call to CoinCap.io
// Grid data as an array of arrays
const list = [
['Brian Vaughn', 'Software Engineer', 'San Jose', 'CA', 95125 /* ... */ ]
// And so on...
];
function cellRenderer ({ columnIndex, key, rowIndex, style }) {
return (
<div
key={key}
style={style}
>
{list[rowIndex][columnIndex]}
</div>
)
}
ReactDOM.render(
<Grid
cellRenderer={cellRenderer}
columnCount={list[0].length}
columnWidth={150}
height={300}
rowCount={list.length}
rowHeight={60}
width={700}
/>,
document.getElementById('root')
);