Uncaught Invariant Violation: Objects are not valid as a React child (found: object with keys {}). If you meant to render a collection of children, use an array instead.
in BreadCrumb (created by Connect(BreadCrumb))
in Connect(BreadCrumb) (at Dashboard.js:607)
in div (at Dashboard.js:606)
in Dashboard (created by Connect(Dashboard))
in Connect(Dashboard) (created by Form(Connect(Dashboard)))
I get this error sometimes.
Screenshot of error: https://screenpresso.com/=hjLdf
code in BreadCrumb.js:
class BreadCrumb extends Component {
render() {
const { title, subpath, subpath2 } = this.props;
return (
<h3 className="text-themecolor">{title}</h3>
);
}
}
code in dashboard.js:
class Dashboard extends Component {
render() {
var title = "Dashboard", subpath = "Dashboard";
return (
<BreadCrumb title={title} subpath={subpath} />
);
}
}
props.titleis a string and not anObject. You are passing it inside the <h3> and react doesn't know how to render it if its an Object. A good way to know that this is happening is also by adding a propType to Breadcrumb like this:BreadCrumb.propTypes = { title: propTypes.string }it will display a warning in the console like:Warning: Failed prop type: Invalid proptitle` of typeobjectsupplied toBreadCrumb, expectedstring.` - Luciano Semerini