Chapter 9 · Example 1 · Refs: from storing data to imperative API

Storing input value in a ref

Saving the input value to ref.current in onChange instead of state works for a basic submit, showing how a ref persists data between re-renders.

Loading live editor…