Advanced React

Join the React Bootcamp

The React Bootcamp is 5 full weeks of professional React training to take you from wherever you are to top-tier React programmer in record time.

Lifetime Access

Complete Package
Become a React Pro

Input Focus

Use the "Focus" button focus the input with the help of a ref that you connect with the underlying input element.

Note that you can focus any input using the focus method.

This lesson is part of the full version of the React Bootcamp.

Click here to purchase.
Already joined? Log in here


In this component, we have a simple form that includes an input as well as a button labeled "Focus".

Your challenge is to enable the input to be focused upon clicking this button.

Firstly, you'll need to change the button's type from submit to button to prevent the page from reloading. Then, y...