Basically, I've got this pretty simple react component. What it does is, is wrap around 'react-intercom' and only render it if there is a change in the state. To simplify the question, I've hardwired the shouldCompoenentUpdate()
method to always return false.
import React from 'react';
import Intercom from 'react-intercom';
class IntercomWrapper extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
// console.log(!!nextProps.user && nextProps.user.userId !== this.props.user.userId);
// return !!nextProps.user && nextProps.user.userId !== this.props.user.userId;
return false;
}
render() {
console.log('rendering');
return <Intercom {...this.props} />;
}
};
export default IntercomWrapper;
What happens is that it always rerenders, which should not happen.
Anyone has any idea why would that happen?