insertRow={true} causes Invariant Violation: Objects are not valid as a React child
See original GitHub issueI 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"}]
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Invariant Violation: Objects are not valid as a React child
This error usually happens because a function involved in dispatching an event has been given an unexpected object type (i.e passing an object...
Read more >Understanding the "Objects are not valid as a react child" Error ...
The problem starts when myVariable assumes an object. React has no way to tell what to render when provided with an object, thus...
Read more >Invariant Violation: Objects are not valid as a React child
Sometimes you might try to display data in a React application and you might see the following error in the console: Objects are...
Read more >Resolving Error: "Objects are not valid as a React child"
As the error message states, React cannot render objects as children directly. If you are seeing this error, there is a good chance...
Read more >Objects are not valid as a React child React error | bobbyhadz
The React.js error "Objects are not valid as a React child" occurs when we try to directly render an object or an array...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Allen, I think I was using the latest version - I had been going through all my dependencies and updating them. I will try again and let you know.
I am also experiencing this invariant violation using the 4.3.0 build.
Whenever the insertRow property is added I receive the following error:
“Invariant Violation: Modal.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.”
I have copied one of the example tables’ code.
Any assistance is appreciated!