All jobs / Frontend / web developer / Vue

Frontend / web developer interview question · 0–1 years

A child component receives a quantity prop and has plus and minus buttons.

In Vue, how should the child change the quantity?

The strongest answer

It must not mutate the prop. It emits an event with the new value and the parent updates its own state — or the pair is wired with v-model, which is the same prop-plus-event contract

Why it works

Right — one-way data flow: props down, events up. v-model on a component is sugar for exactly that.

What a good answer covers

Answers that fall short

Who gets asked this

More Vue questions