All jobs / Frontend / web developer / Vue

Frontend / web developer interview question · 1–3 years

In setup, a developer writes const { count } = state, where state is a reactive object. The template shows count, but it never updates.

What went wrong, and what are the fixes?

The strongest answer

Destructuring copied the current number out of the reactive proxy, so the link is lost. Read state.count directly, use toRefs to destructure into refs, or hold the value in a ref from the start

Why it works

Right — reactivity lives on property access through the proxy. A destructured primitive is a plain copy; toRefs keeps the connection.

What a good answer covers

Answers that fall short

Who gets asked this

More Vue questions