Capítulo 82 de 116
createRef() creates a standalone ref object outside of the Hooks system — the class-component-era equivalent of useRef, appropriate only inside a class component's constructor, not in function components.
const ref = createRef() — returns { current: null }, structurally identical to what useRef(null) returns.constructor and stored on this (this.inputRef = createRef()), then passed to a JSX element's ref attribute inside render().useRef, createRef() creates a brand-new ref object every time it's called — calling it directly in a function component's body would produce a fresh, disconnected ref on every render, defeating the entire point of a persistent ref. useRef exists precisely to solve this for function components.useRef (Ch 62) instead.createRef belongs exclusively to class components — in function components, always use useRef.createRef() inside a function component's render body is a bug: it produces a new, useless ref every render instead of a persistent one.{ current: value } shape — the difference is entirely about when and how many times the ref object gets created.