React › Hooks

What is the difference between useState and useRef? When would you use useRef instead of useState?

technical
intermediate
Model Answer

useState triggers render; useRef stores mutable value/DOM ref without render. Explain the concept, why it matters, one practical example, and one common pitfall.

Sign up to see the full answer

Free account includes AI feedback, hints, mastery tracking, and 2,000+ questions.

What you get with OfferLoop

AI Practice & Feedback

Submit your answer, get instant AI scoring and improvement tips.

Full Model Answers

Detailed model answers with hints and explanations for every question.

Mastery Tracking

Track which questions you can answer confidently vs need practice.

2,000+ Questions

Behavioral, technical, system design, HR — all topics covered.