Trying to pass the prop 'column' to the Table element results in a "TypeError: column.getHeaderProps is not a function" error.
The following code will trigger it:
<ReactTable
data={[{name: 'Bob' }]}
columns={[{Header: 'Name', accessor: 'name'}]}
column={{className: 'table__cell'}} />
Using version 6.5.1 with react 15.6.1.
You're losing all of the other column defaults when you completely override it like that. Since column is an object, you need to merge your desired settings into the existing object.
column={
{
...ReactTableDefaults.column,
className: 'table__cell'
}
From the documentation:
import { ReactTableDefaults } from 'react-table'
Object.assign(ReactTableDefaults, {
defaultPageSize: 10,
minRows: 3,
// etc...
})
I see, thank you.
Most helpful comment
You're losing all of the other column defaults when you completely override it like that. Since
columnis an object, you need to merge your desired settings into the existing object.From the documentation: