Book Image

Vue.js Quick Start Guide

By : Ajdin Imsirovic
Book Image

Vue.js Quick Start Guide

By: Ajdin Imsirovic

Overview of this book

Vue.js is the latest trending frontend framework. Simplicity, reactivity, and ?exibility are some of the key benefits that Vue offers to developers. This book will help you learn everything you need to know to build stunning reactive web apps with Vue.js 2 quickly and easily. This book will take you through the Vue 2 framework. You will start by learning the different Vue installation options: CDN, NPM, and Vue CLI. Then we will look at the core concepts of Vue: templates and components – ways to modularize Vue code. You will learn how to utilize directives, which are Vue-specific HTML attributes with additional features. Also, you will see how Vue uses a streamlined approach to development, with reusable methods, computed properties, and watchers, and how it controls state with the help of its data option. You will learn about the concepts of reactive programming in Vue, and how to understand communication between parent and child components. We will take a look at props and slots, working with CSS, filters, and mixins. We will also look at ways to add transitions and animations to Vue apps. Then you will extend Vue by building custom directives and your own plugins. Finally, you will learn about Vuex – a Vue plugin that allows us to centralize state, and also introduce Nuxt, which is a framework that builds on top of Vue and solves some issues of single-page applications. After learning about these components, you will be ready to build your own reactive web apps with Vue.js 2.
Table of Contents (15 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

What is state?


An application's state is all its data at a point in time. Since we are usually concerned with the current app's state, we could rephrase this to the following: the state is an app's data as it is right now, resulting from the previous steps that our app took and based on functions inside the app responding to the user interacting with it. 

So, what is it in our app that changes its state? Functions, of course. The user interacts with our app, which triggers functions to change the current state to some other state.

However, as our apps grow, it is not uncommon to have components nesting several levels deep. If we say that state is the source of truth for how our app should display on the screen at any given time, then it would be beneficial to us to make that source of truth as easy to reason about and as simple to work with as possible.

Unfortunately, in complex apps, this is not so easy. Any part of our app, any component inside our app might affect any other part of our app...