1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Focus an input field in React with the `useRef` and `useEffect` hooks

    reactReact

    In this lesson, we make the Search input field focus on page load. To do this, we keep a reference of the input field with the useRef hook, and trigger focus on that field when the component mounts with another React hook, useEffect.