4👍
✅
reactive
doesn’t work with Arrays. Seems to be a limitation of the composition api. You can read a similar discussion here.
Use ref
instead of reactive
, it should work fine. I have built a few apps like this and can confirm it working.
So write: const state = ref<Array<Notification>>([]);
, you will have it working. And as a rule of thumb, use ref
for anything but objects, that’s when you want to use reactive
. It’s more complex than that but if you use them like this, it will always work.
Source:stackexchange.com