Discover how React magically updates your app without you lifting a finger to touch the DOM!
Why Updating phase in React? - Purpose & Use Cases
Imagine you have a web page showing a list of items, and every time a user clicks a button, you want to update one item's details on the page.
You try to find the exact spot in the HTML and change it manually with JavaScript.
Manually updating the page is tricky and slow. You must carefully find the right element, update it without breaking others, and handle many edge cases.
This often leads to bugs, inconsistent UI, and a lot of repetitive code.
The React updating phase automatically figures out what changed in your data and updates only those parts of the page.
You just change your data (state), and React efficiently updates the UI for you.
const item = document.getElementById('item-3'); item.textContent = 'New value';
setItems(items => items.map(i => i.id === 3 ? {...i, value: 'New value'} : i));
This lets you build dynamic, fast, and reliable user interfaces that update smoothly as data changes.
Think of a chat app where new messages appear instantly without reloading the whole page.
Manual DOM updates are error-prone and hard to maintain.
React's updating phase handles changes efficiently and safely.
You focus on data changes, React updates the UI automatically.