I am getting this error:
Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/funct
In addition to import
/export
issues mentioned. I found using React.cloneElement()
to add props
to a child element and then rendering it gave me this same error.
I had to change:
render() {
const ChildWithProps = React.cloneElement(
this.props.children,
{ className: `${PREFIX}-anchor` }
);
return (
...
);
}
to:
render() {
...
return (
);
}
See the React.cloneElement()
docs for more info.