Ex. 10 - Autofocus

Instructions

We will make sure that the search field is focused automatically. We could use the autofocus attribute but it would be uncontrolled 😬.

  • Modify SearchInput to support ref and ref.current.focus()
  • Use useRef and useEffect to make the field automatically focused in App

Expected result

The field is focus automatically when the application starts.

Help

How should I forward the reference?

How should I use a reference?