Q. What is the difference between React.Component and React.PureComponent?

  • (A) PureComponent implements shouldComponentUpdate with a shallow prop and state comparison
  • (B) Component is only for functional components
  • (C) PureComponent cannot have state
  • (D) Component automatically memoizes
πŸ’¬ Discuss
βœ… Correct Answer: (A) PureComponent implements shouldComponentUpdate with a shallow prop and state comparison
Explanation: PureComponent avoids re-renders if props/state do not change shallowly.
Explanation by: Mr. Dubey
PureComponent avoids re-renders if props/state do not change shallowly.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
73
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
95%
Success Rate