useRef vs createRef: why createRef breaks in function components | React Interview Deep Dive #13

Publicado el: 08 julio 2026
en el canal de: React Deep Dive
10
4

useRef and createRef look almost identical — both return an object with a current property — but one of them silently breaks in function components. This is a favorite interview question because it checks whether you understand how renders actually work.

After this breakdown you'll know why useRef hands you the same ref object on every render, why createRef makes a brand new one each time the function runs, the subtle DOM/effect bugs that causes, and when each one is the right tool.

In this breakdown:
0:00 useRef vs createRef — why interviewers ask
0:15 useRef: a mutable container that persists across renders
0:35 createRef: a brand new ref object on every call
0:51 The key difference: same ref vs new ref each render
1:01 Why createRef breaks in function components (and the fix)
1:18 When to use each (function components vs class fields)
1:37 The interview-ready answer
1:49 Mental model: useRef is a small pocket inside the component

📘 Full breakdown — 70 Mid/Senior interview questions in "React Interview Deep Dive":
→ Amazon: https://www.amazon.com/dp/B0GX36S9KF
→ PDF (Gumroad): https://ivandeinichenko.gumroad.com/l...

▶ React Deep Dive playlist:    • React Interview Deep Dive — How React Actu...  

#react #reactinterview #frontend #useref #createref #reacthooks


En esta página del sitio puede ver el video en línea useRef vs createRef: why createRef breaks in function components | React Interview Deep Dive #13 de Duración hora minuto segunda en buena calidad , que subió el usuario React Deep Dive 08 julio 2026, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 10 veces y le gustó 4 a los espectadores. Disfruta viendo!