See Refs and the DOM doc.

Use-cases

  • Managing focus, text selection, or media playback.
  • Triggering imperative animations.
  • Integrating with third-party DOM libraries.

Avoid using refs for anything that can be done declaratively.

Access refs

const node = this.myRef.current;