Skip to content

insertRow={true} causes Invariant Violation: Objects are not valid as a React child #1739

Open
@silentbobbert

Description

@silentbobbert

I have upgraded a React app from 15.6.2 to 16.0.0, and updated react-boostrap-table too.

If my JSX looks like:

<BootstrapTable
   ref="licenceTypesTable"
   insertRow={true}
   data={this.props.licenceTypesData.licenceTypes}
   striped={true} 
   hover={true}
   options={options}
   search={true}
   exportCSV={true}>
      <TableHeaderColumn dataField="id" isKey={true} autoValue={true}>ID</TableHeaderColumn>
      <TableHeaderColumn dataField="title" dataSort={true}>Type</TableHeaderColumn>
</BootstrapTable>

Then it fails to render.

I get this console message:

Invariant Violation: Objects are not valid as a React child (found: object with keys {$$typeof, key, children, containerInfo, implementation}). If you meant to render a collection of children, use an array instead.
    in Modal
    in div
    in ToolBar
    in div
    in div
    in BootstrapTable
    in div
    in div
    in div

If I remove the insertRow attribute, the error goes away, and the component will render again.

I was relying on insertRow to provide UI to add new data, it would be a shame to have to roll my own.

It is helps, licenceTypes is a very simple array:

licenceTypes: [{id:1, title: "MIT"}, {id:2, title: "Apache-2.0"}]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions