Accessing DOM Elements

Learn how React uses a virtual DOM for efficient DOM updates and how refs serve as a means to directly work with DOM elements in the framework.

Direct DOM manipulation before React

Before a modern UI framework was introduced, to make a change to the screen, we worked directly with a DOM element. In the code below, a basic HTML body is combined with JavaScript to modify the content of an h1 element.

Get hands-on with 1200+ tech skills courses.