Refs interview questions
Practice 3 questions on refs. Each runs in a real in-browser editor with Jest tests and a worked, diagram-backed solution.
3 questions
- JavaScriptCoding exercise
useLatest
EASYImplement a hook that returns a ref always holding the newest value, so callbacks and effects can read it without going stale.
15 minPractice - JavaScriptCoding exercise
usePreviousDistinct
MEDIUMImplement a hook that remembers the last value that actually differed from the current one, with a customizable comparator.
25 minPractice - JavaScriptCoding exercise
withLoading
MEDIUMImplement a higher-order component that selects loading UI, forwards ordinary props and refs, and exposes a useful display name.
25 minPremium questionPractice