Level 80
@udev You’d be better off creating a reactive object to track property changes:
const foo = reactive({});
foo[key] = value;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How can I add(or update if exists) a property to ref object. I have tried the the following:
cont object = ref({})
const addOrUpdateObject = (key,val) => {
object.value[key] = val
})
I get error "Cannot set properties of null"
@martinbean can't do that in my case as the properties are dynamic. Managed to find a workaround where I create a temporary object then replace the whole ref object, i.e.,
cont object = ref({})
const todo= () => {
let temp = {}
//todo loop
temp[key] = val
object.value = temp
})
~~~
Please or to participate in this conversation.