Which React hook stores a mutable value that persists across renders without causing a re-render?
Correct answer
B. useRef
14 views
B. useRef
14 views
useRef returns an object whose .current property survives re-renders. Changing it does not trigger an update, which makes it useful for DOM references, timers and previous values.
Asked in: React Interviews, Frontend Developer Tests
Not sure why the answer is B? Ask here and get an explanation.