Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

216
Visualizações
Cell data not displayed by react-table

My data is not visible inside the react-table's cells:

import React, { useMemo } from 'react'
import { useTable } from 'react-table/dist/react-table.development'
import MOCK_DATA from '../mock/components/LandingTableMock.json'
import { COLUMNS } from './LandingTableColumns'
import '../static/styles/globalVar.css'

export const LandingTable = () => {
  
    const columns = useMemo(() => COLUMNS, [])
    const data = useMemo(() => MOCK_DATA, [])
    

    const tableInstance = useTable ({
        columns: columns, //columns: COLUMNS,
        data //data: MOCK_DATA
    })

    const { 
        getTableProps, 
        getTableBodyProps, 
        headerGroups, 
        rows, 
        prepareRow 
    } = tableInstance

    return (
        
        <table {...getTableProps()}>
            <thead>
                {
                    headerGroups.map((headerGroup) =>  (
                    <tr {...headerGroup.getHeaderGroupProps()}>
                        {
                            headerGroup.headers.map((column) => (
                                <th {...column.getHeaderProps()}> 
                                    {column.render('Header')}
                                </th>
                            )
                        )}
                    </tr>
                    ))
                }
            </thead>
            <tbody {...getTableBodyProps()}>
                {rows.map((row) => {
                    prepareRow(row)
                    return (
                        <tr {...row.getRowProps()}>
                            {row.cells.map( (cell) => {
                                return <td {...cell.getCellProps()}> {cell.render('Cell')}</td>
                            })}
                        </tr>
                    )
                })}
            </tbody>
        </table>
    )
}

I put a breakpoint to inspect the cells value and is undefined. enter image description here

MOCK_DATA and COLUMNS are looking fine, it`s not an include problem. I moved them in the same file and it still does not work.

enter image description here

The result is a table with the right number of rows but empty cells:

enter image description here

I followed this tutorial on youtube.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda