QuizAdvanced
Resetting Component State with a key
Changing a component's key prop forces React to unmount the old instance and mount a fresh one, resetting its state.
You have a <UserProfile /> component that holds internal state (like a draft form). When you navigate between different users, you want the component to fully reset its state. What is the simplest idiomatic React way to achieve this?