Skip to main content
Debug React
All scenarios

React debugging exercise

The edit form keeps the previous customer

about 15 minLevel: FoundationalTopics: stateforms

A customer form keeps showing the previous customer's details after another one is chosen, and saving overwrites the wrong customer. Find out why and make the form follow the choice.

What you’ll practice: useState, props, controlled inputs, edit forms

Bug report

Account managers keep customer contact details up to date in the customer directory: they choose a customer on the left, change their details on the right, and save.

They report that after choosing another customer, the form sometimes still shows the details of the one they had open before, while the heading shows the new name. One manager saved without noticing, and Cobalt Freight was renamed to Alder & Finch. Discard changes puts the right details back.

Reproduce the issue, identify the cause, and make the smallest reliable fix. The list must change only when someone saves, and it reloads when you come back to the tab: that must keep working without losing what you are typing.

Be ready to explain why the form shows the wrong details and how you verified your change.

Included in Full accessThis and 4 more scenarios, plus every new one

$14.50then $29paid once

Get Full access

Not sure yet? Try a free one first: Editing one row changes another

No account. Your practice stays in this browser.

How it works

  1. Reproduce and fix

    Each scenario is a small app with one real bug. Reproduce it in the live preview, find the cause, and make the smallest fix. Five checks confirm the behavior.

  2. Explain your reasoning

    Answer four short questions: what caused it, what you changed, what you ruled out, and how you verified it.

  3. Review another fix

    Judge a proposed fix for the same bug, approve it or request changes, then see how the checks treat it.