Use state for information that affects rendered output because updating state schedules a render. Mutating a ref alone would not update the displayed text.