Expert Mastery

Preview — 3 of 10 questions

What is React Fiber and what problem does it solve?

javascript
// React 15: Stack-based rendering
// Recursive, synchronous — can't be interrupted

// React 16+: Fiber-based rendering
// Linked-list of work units, can pause/resume/abort
AFiber is a CSS layout algorithm used by React Native
BFiber reimplements the reconciler as interruptible units of work — each component maps to a "fiber" node; React can pause high-priority work, do urgent updates, then resume
CFiber is only used in React Native, not React DOM
DFiber enables multi-threading by moving rendering to a Web Worker

When should you use startTransition?

javascript
const [query, setQuery] = useState("");
const [results, setResults] = useState([]);

function handleSearch(e) {
  // Urgent: update the input immediately
  setQuery(e.target.value);

  // Non-urgent: filter large list (can be deferred)
  startTransition(() => {
    setResults(filterLargeList(e.target.value));
  });
}
AstartTransition marks state updates as non-urgent — React may interrupt them to handle more urgent updates (like user input), preventing UI jank
BstartTransition makes the update run in a separate thread
CstartTransition delays the update by 300ms automatically
DstartTransition is equivalent to setTimeout(fn, 0)

What is tearing in the context of concurrent React?

javascript
// External store (outside React) changes during concurrent rendering
const store = createExternalStore();

function useStore() {
  return store.getSnapshot(); // reads external state
}

function A() { const val = useStore(); /* renders with val=1 */ }
function B() { const val = useStore(); /* store changes mid-render → reads val=2 */ }
// A shows 1, B shows 2 — inconsistent!
ATearing is when different components read different values from an external store during the same render pass — the UI shows an inconsistent snapshot
BTearing means CSS styles are applied unevenly
CTearing only happens in React 17 and earlier
DTearing is prevented automatically by all state management libraries

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.