Skip to main content
React.js Intermediate Core Concept Q&A Topic: Fiber & Rendering Engine

What is React Fiber reconciliation and why are stable keys critical?

Quick Summary: Reconciliation is React’s O(n) heuristic diffing algorithm (powered by the Fiber tree) that determines minimal DOM updates between renders; stable unique keys let React track exact list items across inserts, deletions, and reorders.

Written by Ravi Shankar Mishra (Founder & Lead Systems Architect, MockAttempt Academy) Reviewed by MockAttempt Engineering Editorial Desk
Last verified:

Direct Interview Answer

Rather than solving generic O(n³) tree diffing, React applies two pragmatic assumptions: (1) elements of different types (e.g., <div> vs <span>) tear down and rebuild subtrees; and (2) sibling lists carry explicit key props.

React Fiber breaks rendering work into interruptible priority units so urgent user input stays responsive during large component updates.

Detailed Technical Explanation

Using array indices (key={idx}) in sortable or filterable lists tricks React into matching old DOM inputs/local state at index 0 with a totally different record after prepending an item—corrupting checkboxes, focus, and animations.

Practical Walkthrough

Comparing stable database ID keys vs broken index keys during list prepends.

Code Example — JAVASCRIPT
// Anti-pattern: index keys shift when items insert at top
// items.map((item, idx) => <Row key={idx} item={item} />)

// Correct: stable domain identifier preserves Fiber identity & input state
function TodoList({ items }) {
    return items.map((item) => <TodoRow key={item.id} item={item} />);
}
Expected Output / Verification
Each Fiber node preserves its local state across filtering and sorting.

Real-World Production Use Case

Dynamic Kanban boards, editable invoice line-item tables, and virtualized feeds in React 19 SaaS dashboards.

Common Interview Mistakes to Avoid

  • Generating random keys inside render like key={Math.random()}, forcing React to unmount and remount every DOM node on every render.
  • Using array index keys on dynamic lists with uncontrolled inputs or animations.
Topics: #react #reconciliation #fiber #keys
Learn. Practise. Prove. Get Career-Ready.

Ready to Build Your IT Career?

Explore industry-led programmes and develop practical skills through training, assessments and interview preparation.