This code in React.js need to show a simple table with cells filled by data from db.json, but the only thing I see is a blank page, I tried to console.log(cell) inside the td and the correct information was logged but yet nothing was shown on the screen.
Sheet.js
import React from 'react'
function Sheet() {
const data = require('../store/db.json')
const mySheet = data.sheet1
return (
<>
<table>
<tbody>
{
Object.entries(mySheet).forEach(([row, cols]) => (
<tr key={row}>
{
Object.entries(cols).forEach(([col, cell]) => (
<td key={`${row},${col}`}>
{cell}
</td>
))
}
</tr>
))
}
</tbody>
</table>
</>
)
}
export default Sheet
db.json
{
"sheet1": {
"1": {
"1": "1,1",
"2": "1,2",
"3": "1,3"
},
"2": {
"1": "2,1",
"2": "2,2",
"3": "2,3"
},
"3": {
"1": "3,1",
"2": "3,2",
"3": "3,3"
}
}
}