Change the key to reset a component's state
A form that keeps showing the previous user's draft when you navigate to the next user is holding state in a component that React reused. Give it a key that changes with the identity.
<EditUserForm key={user.id} user={user} />A new key unmounts the old instance and mounts a fresh one. It is the intended way to reset state, and it is one prop instead of an effect that syncs props into state.
react