Skip to content

Topics

Jump to a topic.

Search questions

Find a question by title, tag, or summary.

Chapter 04

Refs and the DOM

Refs are React's escape hatch: a mutable box that survives renders without causing them, and the way to reach DOM nodes. This chapter covers useRef, ref callbacks, ref as a prop, imperative handles, and Fragment refs.
  1. 010When should you use a ref instead of state?Coremedium
  2. 020How do ref callbacks work, and what changed with ref as a prop?medium
  3. 030How do you expose a limited imperative API with useImperativeHandle?medium
  4. 040What can a Fragment ref do that a DOM ref can't?hard