React Reconciliation

Aman jain
2 min readNov 28, 2023

React Reconciliation

Toh, picture ye hai ki React ka reconciliation ek bahut important concept hai. Ye basically process hai jisme React check karta hai ki kya changes huye hai component ke props ya state mein aur phir wo changes ko reflect karta hai DOM mein.

Toh aap imagine karo, ki aapki website pe koi ek component hai jiska data change ho gaya. Ab React kehta hai, “Chalo bhai, ab main check karunga ki kya changes huye hain.” Wo pehle naye aur purane data ko compare karta hai, fir dekhta hai ki kya actual DOM mein change hona chahiye.

Ye process bahut smart hai, kyun ki React sirf actual changes ko update karta hai instead of pura DOM rebuild karke. Isse performance improves hoti hai.

Ab, agar React ko lagta hai ki data mein kuch badlaav hua hai, toh wo ek algorithm use karta hai jiska naam hai “Diffing algorithm.” Ye algorithm compare karta hai purane aur naye elements ko, fir decide karta hai ki kaunsa specific part update hona chahiye.

Toh basically, reconciliation ye hai ki React smart tareeke se detect karta hai ki kya changes huye hain aur sirf wohi changes ko update karta hai, jo ki performance ko bhi improve karta hai. Samjha kya?

Bhai or ye interview question h, mostly interviewer is question ko jarur karte te h ki

DOM AND VIRTUAL DOM M KYA DIFFERENCE H.

--

--