Why do we use Vue.js?

May 18, 2020

Vue.js is a Javascript framework focused on building user interfaces and single-page applications (SPA). It lets you extend HTML attributes for offering more functionalities. Vue.js uses double braces {{ }} for holding the data. The Vue object is connected with the HTML element and that element changes as the Vue object changes.

Vue.js is already included with Laravel and that makes a very powerful combination for creating complex websites. It allows Laravel to focus on the server at the back end, connect with the database and manipulate with data. On the other hand, Vue.js can manipulate with data and HTML elements on the view layer of an application at the user side.

There are many use cases where we don’t want to refresh the entire website for every small change. For example, you have probably used the Follow and Unfollow button many times. It would be redundant and unprofessional to do it through Laravel where we send a request to the server, make a change, and get the response to the user. By using Vue.js we can let the user follow and unfollow as much as he/she wants, while the website doesn’t refresh at all.

At present time the users are used to fancy websites and easy to use applications. They expect to have SPA that quickly react to their interactions. A user nowadays doesn’t feel like waiting too long for a website to load or reload. Thus, it’s up to us as developers to keep up with the latest technologies and provide the best user experience.

It’s worth noting that Vue has a shallow learning curve as it is very easy to learn. The syntax is simple and easy to understand. There are many examples for using Vue.js like creating a modal component, dynamic table grid, todo list, etc.