React manages DOM refs during the commit phase: it assigns the mounted DOM node to ref.current and resets ref.current to null when that node is removed.