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
Auf dieser Seite können Sie das Online-Video useRef vs createRef: why createRef breaks in function components | React Interview Deep Dive #13 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer React Deep Dive 08 Juli 2026 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 10 Mal angesehen und es wurde von 4 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!