-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Labels
Description
Turns out if a component has any refs created with React 16+ the lib crashes. For example, trying to react-element-to-jsx-string
the following component:
class Example extends React.Component {
constructor(props) {
super(props);
this._ref = React.createRef();
}
render() {
return <div ref={this._ref} />;
}
}
... Will result in the following crash:
Uncaught RangeError: Maximum call stack size exceeded
at Array.reduce (<anonymous>)
at sortObject (index.js:225)
at eval (index.js:230)
...
A (hopefully) temporary fix is to filter out said props, but I don't think this is ideal.
this.reactElementToJSXString(item, {
filterProps: ['ref', 'key']
...
});