How to deal with the update of the child component caused by the update of the parent component of react

my data is placed in the parent component ajax request and then passed to the child component

I find that a piece of my sub-component is updated frequently, and sometimes the data is updated when the data does not change, and the comDidM of the sub-component has no data.
the sub-component can only get the data when the props is updated

.

I don"t know if there"s something wrong with my writing.
in that case, where do I judge a lot of talents without additional render subcomponents in should?
I don"t know how to deal with it.

Mar.23,2021

1. Judge
2 in shouldComponentUpdate. PureComponent


is used for pure presentation of subcomponents.

try replacing Component with PureComponent .

PureComponent can automatically make a shallow comparison of prop ; if there is no change, the render will be avoided.


Why doesn't the diff algorithm work?

Menu