FlashcardAdvanced
Resetting Component State with a key
Changing a component's key forces React to unmount the old instance and mount a fresh one, resetting its state.
Question
How can you reset a component's internal state when a prop changes?
Click to reveal answer