简体   繁体   中英

type is invalid -- expected a string but got: undefined

I am trying to use react-bootstrap table 2 and I would like to do column span.

Here my example,

<BootstrapTable data={this.state.timesheets} >
    <TableHeaderColumn row="0" dataField='empid'>Field B</TableHeaderColumn>
    <TableHeaderColumn row="0" dataField='tdate'>Field C</TableHeaderColumn>
    <TableHeaderColumn row="0" colSpan="2">In</TableHeaderColumn>
    <TableHeaderColumn row="1">Time</TableHeaderColumn>
    <TableHeaderColumn row="1">Date</TableHeaderColumn>
</BootstrapTable>

I got this error:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

At the first step, this.state.timesheets would be nothing, so I thought because of this and I added one attribute noDataIndication="Table is Empty" . but this error is still happening.

Please help.

According to the documentation, TableHeaderColumn will no longer support in react-bootstrap table 2.

Documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM