Reputation: 147
I am completely familiar with Vuex but I don't know anything about Vue composition API. what is it all about, What's the difference between it and Vuex? Which gap in Vuex does it cover and when and where is better to use each of them? thanx for the help.
Upvotes: 5
Views: 1911
Reputation: 1136
First of all, vuex is a library and a pattern to perform state management. vue composition api is a new vue-native (as of version 3; still a component library for version 2.x) way of working with components and state strongly based on composition functions, which would eventually make the code more readable, better organized, with better performance, and easier to maintain.
As per its RFC:
"Instead of relying on the magical this
context, a composition function relies only on its arguments and globally imported Vue APIs. You can reuse any part of your component logic by simply exporting it as a function."
I think that's the key point around which the rest is organized.
Upvotes: 2