Testing the useRef Hook

Learn how React allows direct DOM manipulation and supports parent-child interaction.

Using useRef to control DOM elements

There's always a chance that React runs short in terms of controlling the internals of a DOM element. Let's say there's an input and a button, as in the image below, Upon a button click, we want to manually focus on the input:

Get hands-on with 1200+ tech skills courses.