Interview Q&A / System Design
System Design interview questions
Caching, scaling, databases and classic design problems for beginners.
Prefer rapid revision? Practise System Design short interview answers →
- How do you focus an input automatically when a component mounts?
Attach a ref to the input with ref={inputRef}, then call inputRef.current.focus() inside a useEffect with an empty dependency array. The ref is filled only after the element is in the DOM.
BeginnerQuick answer1 min read