What is Vue.js?
- Vue is a progressive framework for building user interfaces.
- We can also start using VueJS file from the CDN library.
- The link https://unpkg.com/vue will give the latest version of VueJS.
- VueJS is also available on jsDelivr (https://cdn.jsdelivr.net/npm/vue/dist/vue.js)
- We can host the files at our end, if required and get started with VueJS development.
- The data binding feature helps manipulate or assign values to HTML attributes, change the style, assign classes with the help of binding directive called v-bind available with VueJS.
- Components are one of the important features of VueJS that helps create custom elements, which can be reused in HTML.
- Components in a Vue application can have their own state.
- Components in Vue.js out of the box can communicate using
– props to pass state down to child components from a parent, – events, to change the state of a parent component from a child, or using the root component as an event bus
What is Vuex?
- Vuex is the official state management library for Vuejs. It’s job is to share data across the components of your application.
- Vuex is not the only state management option you can use in Vue, but its main advantage is that it’s official, and its integration with Vue.js is what makes it shine.
- It serves as a centralized store for all the components in an application, with rules ensuring that the state can only be mutated in a predictable fashion.
- Vuex uses a single state tree – that is, this single object contains all your application level state and serves as the single source of truth.
- A single state tree makes it straightforward to locate a specific piece of state, and allows us to easily take snapshots of the current app state for debugging purposes.
- The single state tree does not conflict with modularity – in later chapters we will discuss how to split your state and mutations into sub modules.