DEV Community

Discussion on: Build a movie search app using the Vue Composition API

Collapse
vuesomedev profile image
Gábor Soós Author

Similar to the case where you destructure the a reactive object instead of using toRefs?

Collapse
kwiat1990 profile image
Mateusz Kwiatkowski

Normally. as far as I understand the whole concept, you must wrap with toRefs a value, which you want to spread or destructure in order to retain its reactivity.

And in case of props, which you pass as parameter to setup() you can't use destructuring inside function signature, e.g setup({name}), because as soon as the name prop will be updated, you end up with its old value due to lost of reactivity. Destructuring is supported only for properties of context, so I suppose this should work: setup(props, {attrs, emit}).