Reputation: 2893
const header = ReactDOMServer.renderToString(<MyComponent testprops={this.props.testprops} />)
I am getting a "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object." issue only in internet explorer 11.
When i remove the above code , it worksperfectly , i need the abpve code for window.print() with header
Fix:
const MyComponent = React.memo(props => {
return (<span>Testing</span>)
})
changed to
class MyComponent extends PureComponent {
return (<span>Testing</span>)
}
The React.memo throws error
Upvotes: 1
Views: 663
Reputation: 2893
ReactDOMServer.renderToString(<MyComp />)
MyComp shouldn't constructed with React.memo
or <Fragment>
, IE11 throws Element type is invalid error for both.
Removing React.memo
or <Fragment>
will resolve the issue
Upvotes: 1