All 35 Bugs /
0/35 Fixed ✓
ReactMedium~10 min

Derived State Copying Props Causes Stale UI

What's Broken (Symptom)

Copying `props.price` into local component state once on mount leaves the displayed total stuck on the old product price when parent switches products.

Expected Behavior

  • • Compute derived values directly from current `props.price` and `qty` inside `render()` instead of caching stale prop copies.

Debugging Hints (0/2 used)

Try spotting the bug in the editor first. Need a nudge? Reveal Hint 1 anytime.

Root Cause Breakdown

Pass all 1 automated verification checks on the right to unlock the full Root Cause explanation.

Automated Bug Verification

1 Checks Ready
  • Reflects updated props.price immediately on re-renderSwitching props.price from 100 to 250 outputs total 500.
bugfix.js
Live Sandboxed PreviewCtrl + Enter to verify
Console Output0 log(s)
No console output yet. Run Preview or Verify Bug Fix.