The key prop is used by React to identify which items have changed, are added, or are removed. Unmounting the previous instance simply means that all state that had existed in the component is completely removed. This is another little known secret about React key prop.

2m read timeFrom towardsdev.com
Post cover image
Table of contents
Controlling react component instancesA closer look inside the component

Sort: