Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

322
Views
React.PureComponent - Why is this not implemented in React by default?

I have read about the differences between the Component and PureComponent classes of React and understood that PureComponent does the shallow comparisons of props and state in order to efficiently manage the renderings. Here are few questions,

  1. If the PureComponent optimizes renderings by avoiding unnecessary re-renders, Why doesn't it come By Default in the React (may be by implementing the handling of shouldComponentUpdate() in the Component class itself as React is all about efficiently updating the DOM).

  2. When do someone want to re-render a page even when the props and state remains unchanged, i.e. when to use Component over PureComponent?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Because doing the shallow props and state diff is not free, it requires a (tiny amount of) work. Since React already diffs with the DOM and only changes what you've changed in your re-rendered version (if anything), it's already doing one diff. Doing two (diffing the props and state, and then diffing w/the DOM) is sometimes useful (if they're unlikely to have changed), sometimes not (if they're very likely to have changed). So you can use PureComponent (or implement shouldComponentUpdate) if you think it will be useful, and not if you don't.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!