Is there any problem with using PureComponent in React or is there any hole in PureComponent?

PureComponent is a shallow comparison in shouldComponentUpdate

using PureComponent can avoid a lot of useless calculations when the component renders again. Is there any problem or pit in using PureComponent in practice?

according to my understanding, as long as immutable is satisfied, there should be no problem

Nov.09,2021

Yes, as long as immutable is satisfied, there will be no problem, so it is suitable for immutable.js to use.
pit, you can think of immutable and shouldComponentUpdate shallow comparison, probably can also think of, that is, state or props is a reference type, if you directly change the internal properties, instead of returning a new reference, there will be a problem.
for example:

const foo = this.state.arr;
foo.push(5);
this.setState({
    arr: foo,
})

because foo is arr , when shallow comparison, it will return false , but will not re- render

.
Menu