The official React docs state that “React.PureComponent
‘s shouldComponentUpdate()
only shallowly compares the objects”, and advises against this if state is “deep”.
Given this, is there any reason why one should prefer React.PureComponent
when creating React components?
Questions:
- is there any performance impact in using
React.Component
that we may consider going forReact.PureComponent
? - I am guessing
shouldComponentUpdate()
ofPureComponent
performs only shallow comparisons. If this is the case, can’t said method be used for deeper comparisons? - “Furthermore,
React.PureComponent
‘sshouldComponentUpdate()
skips prop updates for the whole component subtree” – Does this mean that prop changes are ignored?
Question arose from reading into this medium blog, if it helps.