Vue 3 change reactive object

Viewed 1943

I have some struggles changing reactive object in Vue 3. For now my app works like that:

 let selected = ref({
            label: items[0].label,
            icon: items[0].icon,
            class: items[0].class,
            component: items[0].component
        });

as you see I'm not using reactive here, reactive should look like: let selected = reactive(items[0]);

and when I'm changing ref, it works like that:

function select(value : any) { //Record<string, any> ) {
      selected.value = value;

      emit('update:modelValue', value);
    }

And that works as expected, but when I change to reactive object, I'm removing value from function select, and it's not changing the object. How to fix that?

btw: I'm using TypeScript

0 Answers
Related