Chapter 6 · Example 6 · Deep dive into diffing and reconciliation

State reset with key

Giving the two conditional inputs different key values forces React to unmount and remount on switch, resetting the field so typed text no longer carries over.

Loading live editor…