I want to display data from local csv with PapaParse.
When I'm trying to do this code I only see array in console.log()
.
renderRows = () => {
const myData = require('./data.txt');
papaparse.parse(myData, {
download: true,
delimiter: '\t',
complete: function (results) {
console.log(results);
const rows = results.data.map((result, index) => (
<tr key={index}>
<td>{result}</td>
</tr>))
return (rows);
}
});
}
render() {
return (
<div>
This is table
<table>
{this.renderRows()}
</table>
</div>
); }
}