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

99
Views
React diff why not mapRemainingChildren at once directly?

I spent time reading stuff about React diff algorithm recently, and I get to know there are two steps of array-like children diff:

  1. loop from both current first fiber and react first element, compare type until conflicts
  2. mapRemainingChildren and keep looping the remaing react element , try find usable old fiber.

So, here is my question, why not mapping all old fiber at once ? Like why not only use step2 ?

I believe both steps above should share a same time complexity like O(N), to keep React diff average O(N). And step2 could cover cases in step1. So, I think step1 is quite redundant.

Is there any more consideration about this design?

about 4 years ago · Juan Pablo Isaza
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!