Open
Description
Ref shouldn't be used when reading or writing for a value used when rendering: https://react.dev/reference/react/useRef. And the output from this hook can clearly be used for rendering.
The react doc actually explains how to do this, and it is a bit dirty: https://react.dev/reference/react/useState#storing-information-from-previous-renders.
Here's the issue that I opened, to which Dan Abramov answered and made me aware of this problem: facebook/react#25893