cf.completefrontend

ConceptMedium

What does React do inside when a component's key changes, and why does that reset its state?

The code
<ProfileForm key={userId} userId={userId} />

The answer

Answer it out loud first, the way you would in the interview. Then compare.

Checking your sign-in…