A DOM ref needs one element to point at. Two cases make that awkward: a component that renders a list of siblings with no common parent, and a child component (often from a library) that doesn't pass ref on. A wrapper <div> can break flex, grid or table layout.
Fragment refs solve both. Pass a ref to an explicit <Fragment ref={ref}> (the <> shorthand takes no props). The React 19.3 post announced them as stable. React gives the ref a FragmentInstance, attached in the commit like any ref, which works on the Fragment's first-level DOM children: the nearest host nodes, found by looking through components.
Its methods mirror DOM ones, applied to the group:
- Events:
addEventListenerandremoveEventListeneract on every first-level child;dispatchEventdispatches "on the Fragment" and can bubble to its DOM parent. Children rendered later get the stored listeners, and removed children lose them. - Focus:
focus()andfocusLast()search nested descendants depth-first for something focusable;blur()only acts if focus is inside. - Observers:
observeUsingandunobserveUsingattach anIntersectionObserverorResizeObserverto each child, again following later children. - Geometry and position:
getClientRects()(one flat array),getRootNode(),compareDocumentPosition(), andscrollIntoView(alignToTop).
What a DOM ref still does better. A FragmentInstance is neither a Node nor an EventTarget. There's no style, classList, querySelector or contains, and you can't pass it where a node is expected. It exposes this fixed set of group operations only.
So the interview answer: a Fragment ref lets a parent attach behaviour (listeners, observers, focus, scrolling) to whatever DOM a subtree produces, without changing that DOM or the child components. Each first-level child also gets a reactFragments set naming the instances that own it, so one shared observer can route entries.