All jobs / Frontend / web developer

Frontend / web developer interview question · 1–3 years

Why wrap a handler in useCallback?

The strongest answer

To keep the same function reference between renders when it is passed to a memoised child or listed as an effect dependency; without that, the child re-renders or the effect re-runs every time

Why it works

Right. Reference stability for memo and dependencies.

What a good answer covers

Answers that fall short

Who gets asked this

More Frontend / web developer questions