[Vue/VueX] How to modify local state with an action?

I have a link shortener, and the structure is like so:


When I shorten a link by clicking the button in ShortenLinkForm , I want to add that link, with it’s short form (returned by API) to a previousLinks array which is passed as a prop to PreviousLinksListComponent .

But, the only way I know how to do it is by adding a global “link” object, and setting it’s value to response.data from my axios call.

How can I set a local variable’s value to what’s returned by my API or VueX action?

Code: https://github.com/eacdev/laravel-url-shortener/tree/master/resources/js

Is this not what your code is already doing?