Skip to content
Advertisement

Vue 3 Composition API state not updating when use function [closed]

I have wasted my time for this. I am using Vue 3 options API previously and I am trying change to compostion API. I want to push an object to array but the state doesn’t update value, why this happen?

JavaScript
JavaScript

Advertisement

Answer

You have a syntax error in your code. The function declaration should be as function myFunction() { ... instead of function myFunction {...

Always check the browser console for any error first before asking on internet…

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement