Focus with useRef
Medium · Refs
Use useRef to control the input.
- Clicking "Focus" puts the keyboard focus in the <input> (call .focus() on it).
- Clicking "Clear" empties the input and also focuses it.
The input should be a controlled input (its value lives in state).
Next: Start / Stop Timer