A Complete Beginner's Guide to Vue (2023)

← Home

Vue.js is a frontend framework that is optimized for progressive integration. That means you can have a large app with only a couple Vue components integrated -- or you could start from scratch and work completely within the Vue ecosystem.

Another thing that sets Vue apart is the lower learning curve compared to a lot of frameworks. Instead of having to understand complex topics, if you know HTML, CSS, and JavaScript, you're already pretty close!

Like any framework, it adds a structure and utilities to your frontend so that your app is easier to extend as it grows, is more organized, and you don't have to "reinvent the wheel" as often.

Vue is also really cool because it's ecosystem is really well integrated -- a lot of the utilities that would normally be 3rd party libraries are built by the Vue core maintainers, like Vue Router and Vuex.

Throughout this post, we'll explore the key features of Vue, and create an app together!

Here's what we'll be building, though with some more interactive features. The like button will toggle from the heart outline to the red heart based on user clicks. Also, the character number will count down when someone types in the text box.

Go ahead and check out the HTML and CSS code above, we'll be building off of the HTML with our Vue code.

Setting up a Vue App

For now, we'll use a Vue CDN -- we want a minimalist setup. In the future, you may want a more extensive environment, in which case you can use the Vue CLI.

Go to the settings button on Codepen, switch to the JavaScript tab, and search for Vue on CDNjs. This adds the Vue library to our project, so we can use all of the methods and features that Vue gives us.

Now, we need to create a Vue instance and attach it to our HTML in order to fully integrate Vue!

Let's create a const that stores our Vue instance.

const app = new Vue()

We're going to pass an object when we create this Vue app, it'll have all our configuration and application logic for now.

The first thing we're going to add to that object is el -- which is the element that we want to be the base of our Vue app. In this case the element with the status class.

const app = new Vue({ el: ".status"})

Then, we'll add our data. To test this out, let's add the tweetText as data -- so where we have Hello World! right now will become a variable. Down the road we're going to make more tweets with different text, so it makes sense to make that piece of the tweet dynamic.

const app = new Vue({ el: ".status", data: { tweetText: "Hello World!" }})

When we want to add more dynamic data (or data that will change within our Vue app) we'll add more attributes to this data object.

Now, we can use our newly created data in our HTML and plug in the variables that way! If you've ever used Handlebars or another templating language, it's kind of like that.

(Video) Vue.js Course for Beginners [2021 Tutorial]

If you go to the hardcoded "Hello World!" in the HTML, we can now replace it with {{tweetText}} which will pull from our Vue data!

<p class="tweet-text"> {{ tweetText }}</p>

Try to change your tweetText in Vue, and it'll change in your output as well!

Let's brainstorm for a second on what other data we have that will change within the course of our app.

  • The heart will toggle between liked and unliked
  • Our characters remaining will decrease when we type in the

Let's go ahead and add attributes for those in our data object.

data: {  tweetText: "Hello World!",+ charactersRemaining: 280,+ liked: false}

We'll also make charactersRemaining dynamic in the HTML.

<span class="characters-remaining"> {{ charactersRemaining }} characters remaining</span>

We'll hold off on the liked attribute for now, we'll come back to that in a second.


Now that we have our data, we need to make it update based on user actions.

We're going to add another attribute to our Vue object -- this one will store our methods.

const app = new Vue({ el: ".status", data: { tweetText: "Hello World!", charactersRemaining: 280, liked: false }, methods: {}})

We have two "actions" for our app -- toggling the like and changing the characters remaining number when the user types. Let's work on the character counting first.

We'll add a function to our methods object first:

methods: { countCharacters: function() { }}

Let's think about the logic for this function: we need to count how many characters the user has typed into the textarea. Then, we need to subtract that count from 280 (or our character limit).

Let's create a data attribute for the comment text, and then update that every time the user types in the textarea.

  data: {  tweetText: 'Hello World!',  charactersRemaining: 280,+ commentText: '',  liked: false  },
<textarea placeholder="tweet your reply" v-model="commentText"></textarea>

v-model is a directive that syncs our data attribute with what the user has typed into the textarea. So no matter how much or little they have typed in, commentText will match what they've typed. To take one quick step back, directives are HTML attributes that are provided by Vue, they're prefixed by v-.

Okay, now back to our method. We can access our data in our methods with this.myDataAttribute (here's a great reference on JavaScript's this).

(Video) Vue.js Tutorial: Beginner to Front-End Developer

So, we can update the charactersRemaining with the following logic:

methods: { countCharacters: function() { this.charactersRemaining = 280 - this.commentText.length }}

Now, we need to make sure that countCharacters runs every time the user types in the textarea.

Luckily, Vue has the v-on directive, and we can add the event after it so that we run the method each time that event takes place. In this case, v-on:input="countCharacters" will run the countCharacters method each time the user types in the textarea.

<textarea placeholder="tweet your reply" v-model="commentText" v-on:input="countCharacters"></textarea>

Okay, now let's step back and work on our toggleLike method.

We first need to add the method to our methods object.

methods: { ... toggleLike: function () { }}

The body of the method should change this.liked to the opposite of what it currently is. So:

toggleLike: function () { this.liked = !this.liked}

Now we need to make that action run.

On our reactions div, let's add an event listener.

<div class="reactions like" v-on:click="toggleLike"> ...</div>

It's time to introduce another Vue feature: conditionals!


Vue allows us to conditionally render data with the v-if directive.

Let's add the following span-wrapped emoji within our reactions div:

<span v-if="liked">♥️</span>

Now, our red heart emoji only shows up if liked is true. Let's also add a v-else to our heart outline emoji, so that it only renders if liked is false.

<span v-if="liked">♥️</span> <span v-else></span>

Yay! Now our likes work!

If you had any issues with the above steps, here's a Codepen with what we have so far.

(Video) Vue.js Explained in 100 Seconds

Now that we have our interaction down, how would we create a bunch more tweets with the same functionality but different data? Components!


Similar to other frontend frameworks, Vue apps are broken down into components. We compose components together in order to create full user interfaces. A good rule of thumb is that if a chunk of the user interface is used multiple times, it should be broken into a component.

In a production application, our tweet would probably be broken into subcomponents -- we may have a component for the comment text area, one for the like functionality, one for the profile picture, etc. But, for now, we will just make the full tweet into a component so that we can easily create a bunch more tweets.

First, let's move the logic from our Vue instance into a component.

The first argument to Vue.component is the name of the component, in this case "tweet". We're also turning data into a function that returns an object. This allows us to have multiple tweet component instance, each with separate data.

Vue.component("tweet", { data: function() { return { charactersRemaining: 280, commentText: "", liked: false } }, methods: { countCharacters: function() { this.charactersRemaining = 280 - this.commentText.length }, toggleLike: function() { this.liked = !this.liked } }})

We also need the template for the component -- or the HTML that the component will render. We're going to grab all of the existing HTML and paste into a template attribute on our component.

template: `<div class="status"> <div class="tweet-content"> <img src="https://pbs.twimg.com/profile_images/1070775214370373633/borvu2Xx_400x400.jpg" class="logo" alt="Vue Vixens DC logo"> <div class="tweet"> <a href="https://twitter.com/vuevixensdc">Vue Vixens DC</a> <span>@VueVixensDC · Mar 20</span> <p class="tweet-text"> {{ tweetText }} </p> <div class="reactions"> <span v-on:click="toggleLike" class="like"> <span v-if="liked">♥️</span> <span v-else>♡</span> </span> </div> </div> </div> <div class="comment-bar"> <textarea placeholder="tweet your reply" v-model="commentText" v-on:input="countCharacters"> </textarea> <span class="characters-remaining"> {{ charactersRemaining }} characters remaining </span> </div></div>`

Now, we have a Vue component!

One other quick thing we need to add: the tweet text is going to be different from tweet to tweet. We'll pass in different tweet text for each individual tweet through props -- which allow us to pass data to a component from outside of that component. For now, we'll just specify that our component has a prop associated with it.

Vue.component('tweet', { props: ['tweetText'],...})

We still have to have a Vue app though, so let's add that back into our JavaScript:

new Vue({ el: "#app" })

Cool, now our JavaScript is set, we just have to handle our HTML. In our Vue instance, we're looking for an element with the id app now, so let's create that.

<div id="app"></div>

And, inside of our new Vue app, we'll add some instances of our tweet component.

<div id="app"> <tweet tweet-text="hello world!"></tweet> <tweet tweet-text="hi!"></tweet></div>

Notice how we're passing in our tweetText prop -- Vue converts the JavaScript camel case to kebab case in HTML. Outside of that change, our props look like HTML attributes.

Now our component should be good to go!

One more quick thing though, usually instead of hardcoding each tweet in the HTML, we're going to want to loop through a data structure and create a tweet component for each of those items. Let's look at how to do that in Vue!

We're going to go into our Vue app instance and add some tweet data.

(Video) Vue Basics in Under 5 Minutes

new Vue({ el: "#app", data: { tweets: [ { id: 1, tweetText: "hello world!" }, { id: 2, tweetText: "hi!" } ] }})

Now we'll use another Vue directive, v-for in order to loop through the tweets array and create a tweet instance for each!

<div id="app"> <tweet v-for="tweet in tweets" v-bind:key="tweet.id" v-bind:tweet-text="tweet.tweetText" ></tweet></div>

Notice that we use v-bind twice here -- it allows us to dynamically update html attributes (or use variables within them). Keys are recommended whenever you use v-for -- it allows Vue to identify the child elements better (more).

Awesome! Now we can create more tweets by adding an element to the tweets array!

Here's all of that code together.

More Resources to Learn Vue

First, there's a lot of cool features that you can add to the widget we just built. You can make the profile pictures different from tweet to tweet, along with the date and user data. You can also disable or highlight overflow text in our textarea. You could even use the Twitter API to use real tweets and even make the comment posting work!

Here are some more awesome resources for continuing to learn Vue:

And, if you're interested in more "Beginner's Guides" like this one, I have them for CSS and React as well!

Be the first to know about my posts!

Share this post with a friend!





A Complete Beginner's Guide to Web Development

2020-10-06Read More

The Career Advice I Wish I Had

2019-10-21Read More


What is Vue for beginners? ›

Vue (pronounced /vjuː/, like view) is a JavaScript framework for building user interfaces. It builds on top of standard HTML, CSS, and JavaScript and provides a declarative and component-based programming model that helps you efficiently develop user interfaces, be they simple or complex.

Can I learn Vue in a week? ›

Learn Vue js will take a complete beginner one to two weeks. However, a more experienced programmer might be able to learn the basic concepts within a few hours. It's recommended that people are fluent in Javascript before attempting to learn Vue js. Learning Javascript will take between six to nine months.

Is React or Vue easier to learn? ›

Vue and React are similar tools that provide libraries and frameworks to developers for creating dynamic, fast-loading user interfaces. Vue, on the other hand, is a little simpler than React, so it may be easier to learn for new programmers.

How can beginners learn Vue? ›

There are three different ways to learn Vue js for beginners: books/websites, videos, and podcasts. As a general of rule, it's recommended to know Javascript, HTML, and CSS before you learn Vue js for beginners.

Is Vue good for beginners? ›

One of the best things about Vue is that it is beginner friendly. If you have a basic understanding of HTML, CSS, and JavaScript, you can start building with Vue right away. And, if you're already familiar with other frameworks such as React or Angular, you'll find that Vue is easy to learn and use.

Should I learn Vue 2 or 3? ›

If you or your team is beginning work on a new Vue development project, Vue 3 should be your default choice. Not only does it offer superior performance than Vue 2 but it's also much simpler to understand. Moreover, its basic syntax is similar to that of Vue 2, meaning making the switch is easy.

Which is easier Vue or Svelte? ›

Svelte doesn't have a challenging learning curve.

In order to make the process of creating apps using Svelte easier, it also includes a ton of reusable components that were created using HTML, CSS, and JavaScript. And yet, although simple, it's as powerful, robust and easy to maintain as Vue.

What should I know before learning Vue? ›

6 essential skills for Vue developers
  • HTML & CSS. HTML and CSS are the foundations of the web. ...
  • JavaScript basics and Modern JavaScript (ES6 – ES7 – ES8) ...
  • Git. ...
  • npm or Yarn. ...
  • Vue. ...
  • Vue CLI. ...
  • Putting it all together.

How many hours a week should I learn coding? ›

As a realistic starting point, we typically recommend spending anywhere between five and 15 hours per week on coding if you're looking to make a career-change, fast — but remember, everyone is different.

Why people use Vue instead of React? ›

Vue is faster and smaller, which contributes to better performance. When it comes to hiring developers, both have their advantages and drawbacks. Vue is easier to learn, but React is more popular, and therefore, finding hires is faster.

Is Vue becoming more popular than React? ›

As per StackOverflow Survey 2022, React is the favourite framework of 40.14% of developers, Angular with 22.96%, and Vue with 18.97% of developers.

Why is Vue so popular? ›

Vue is an open-source framework and is supported by donations from partners and sponsors. The open-source approach is one of the reasons for the high popularity of Vue among developers, alongside its functionalities and support that make it a strong competitor to Google-run Angular and Facebook's React.

Where can I learn Vue for free? ›

10 Best Free Courses to Learn Vue. js and Nuxt. js in 2023
  • Vue. js Fast Crash Course (FREE) ...
  • Nuxt. js — Blazing Fast Static Sites with Vue. ...
  • React vs Angular vs Vue. js by Example (FREE) ...
  • Intro to Vue. js (Free Udemy Course) ...
  • Pre-Vue JS: Everything You Need To Know Before You Start! ...
  • Vue. ...
  • Learn Vue. ...
  • Vue.

Should I learn Vue or React 2023? ›

Both Vue and React feature tools for creating new projects. Overall, Vue enables faster project growth and performance, but React. js has a more robust ecosystem, more templates, and more functionality.

Which is easier to learn Vue or Angular? ›

In terms of learning, Vue is easier to grasp as it doesn't require learning new concepts and languages. Unlike Angular, whose documentation also requires knowledge of Typescript, Vue just requires knowing Javascript.

Which is easier Vue or Angular? ›

Vue is simpler to use than Angular since it has built-in app templates and allows for more flexibility. Furthermore, it is easy to integrate Angular or React-based mobility solutions into the Vue platform as Vue.

Is Vue JS still relevant? ›

js applications. But the main focus for 2023, he said, will continue to be making Vue 3 stable. Even though Vue 3 became the new default last February, one year ago, Vue 2 is still being used by what You termed “legacy projects.” He noted that much of the adoption of Vue 3 has been by “new projects.”

Is Vue 2 obsolete? ›

Vue 2.7 is the current, and final minor release of Vue 2.x. Vue 2.7 receives 18 months of LTS (long-term support) starting from its release date on July 1st, 2022. During this period, Vue 2 will receive necessary bug and security fixes, but will no longer receive new features.

Does Google use Vuejs? ›

js's cons, it still can be used in large projects. Most of the issues are addressed in the documentation, so it's a question of search. Among global players utilizing Vue to build their websites are Grammarly, Upwork, Gitlab, Trivago, Nintendo, and even Google.

Why is Svelte not popular? ›

Svelte offers fewer extensions and tools than React and Angular. Yet, this is because this framework has a smaller community and is not backed up by tech giants like Facebook and Google.

Do any big companies use Svelte? ›

If you decide to use Svelte in production, you can be sure that you're not alone. There are many established companies already using it too. According to svelte. dev, some popular companies that already use Svelte, including GoDaddy, NameCoach, Rakuten, 1Password, The New York Times, Creative Tims, and mail.ru.

Why is Svelte so popular? ›

Why is Svelte so popular? Svelte is popular because it allows developers to build web applications in a declarative style, similar to frameworks like React or Vue. js. This can make it easier to understand and develop applications, especially for developers who are familiar with these types of frameworks.

Are Vue developers in demand? ›

With hundreds of businesses around the world using it, including big brands like Google, Adobe and Alibaba, there's a growing demand for Vue. js expertise.

Is Vue becoming more popular? ›

The Jet Brains Dev Ecosystem 2021 poll found that developer proficiency with the two frameworks, and frequency of use, were high, with Vue being on the rise. In a year-over-year comparison, Vue users increased from 34% in 2020 to 43% in 2021, while React users decreased from 64% to 49%.

Do I need bootstrap with Vue? ›

Vue is a JavaScript framework for building applications and the Bootstrap is a CSS framework for styling interfaces. Vue can use Bootstrap as its CSS framework, but it doesn't have to.

How long does it realistically take to learn to code? ›

Most coders agree that it takes three to six months to be comfortable with the basics of coding. But you can learn coding faster or slower depending on your preferred pace.

Is 1 hour a day enough to learn programming? ›

It is true that the more time you put in, the faster you'll learn, but if you're okay with a longer timeframe, an hour a day is plenty. In fact, if you had the choice to spend ten hours learning to code over the weekend versus spending one hour each day of the week, I'd recommend the latter.

Should I use Vue or React? ›

React is the go-to option for many developers because of its simplicity and large community, while Vue provides more built-in features and better performance than React for some use cases. The final answer might boil down to these two points: If we know Vue, or have little experience with React, then Vue is better.

Does Vue need a backend? ›

Vue is a frontend framework that provides a set of tools. These tools help you build the components, design and logic used on the frontend. Vue is not a backend language. This is simply because there is no way to use it as a way to communicate with a database.

What is Vue best for? ›

The Vue. js framework allows software developers to create a template with the help of JSX, JavaScript and HTML. Thanks to its lightweight characteristics and component-based nature, the Vue. js framework can be implemented in almost any kind of new project.

Does Netflix use Vue or React? ›

React has a much larger user base and community support, and many popular websites and applications are built with React, such as Facebook, Instagram, Airbnb, and Netflix. However, this does not necessarily mean that React is always the better choice than Vue.

Why does Facebook use Vue js? ›

Facebook. Facebook used Vue. js for a part of its Newsfeed, proving that Vue. js was mature enough to be implemented for such a use case.

Is Vue growing faster than React? ›

Vue. js offers higher performance speed, and many programmers say it is easier to learn than React. js. Its multiple customization features are also a factor that draws developers to Vue.

Is Vue relevant in 2023? ›

Vue and React are still two of the most popular JavaScript frameworks for building web apps in 2023. Both frameworks offer advantages and disadvantages, so developers must weigh the benefits and negatives when deciding which one to use for their projects.

Which big companies use Vue? ›

The top companies that currently use Vue. js in 2023
  • Google. Google Careers.
  • Zoom. Sign In - Zoom.
  • Microsoft. Microsoft Edge Landing Page.
Apr 3, 2023

What did Vue used to be called? ›

The company was founded in 1999 as Spean Bridge Cinemas by Stewart Blair, a former executive of United Artists Theatres and Tim Richards, a former executive of Warner Bros. International Theatres.

Will Vue overtake React? ›

React was swiftly overtaken by Vue, and the industry quickly developed many third-party tools and improved its environment.

Can I learn Vue without knowing JavaScript? ›

You should keep in mind if learning Vue js is the first framework you learning you might struggle a bit. Since Vue. js is based on Javascript it's highly recommended that you at least have a basic knowledge of Javascript, otherwise you will have a difficult time understanding how to write and execute code within Vue.

Is Vue 3 easy to learn? ›

Easy to learn – Vue. js is intuitive, making it easy to understand and great for beginners thanks to its documentation. All you need to know are the basics of HTML and JavaScript. Easy to scale - The application is easily scalable and can be used to perform a number of local tasks in large projects.

Are there hooks in Vue? ›

Vue components are created and exist inside of these functions, which are known as lifecycle hooks.

Do you need HTML for Vue? ›

Vue uses an HTML-based template syntax that allows you to declaratively bind the rendered DOM to the underlying component instance's data. All Vue templates are syntactically valid HTML that can be parsed by spec-compliant browsers and HTML parsers.

What website uses Vue? ›

Download a list of all 1,587,332 Current Vue Customers
fox32chicago.comUnited StatesHigh
shop.whataburger.comUnited StatesHigh
amoeba.wolfram.comUnited StatesVery High
frontend.blstaging.wtatennis.comUnited StatesVery High
37 more rows

Which online IDE is best for Vue? ›

The recommended IDE setup is VSCode + the Vue Language Features (Volar) extension. The extension provides syntax highlighting, TypeScript support, and intellisense for template expressions and component props. Volar replaces Vetur, our previous official VSCode extension for Vue 2.

What is Vue software used for? ›

What Is Vue Used For? Vue is a JavaScript framework that facilitates the UI (user interface) development of websites and single-page applications. A progressive JavaScript framework, Vue makes creating user interfaces simpler and more enjoyable.

What is Vue useful for? ›

First and foremost, Vue. js was designed for prototyping. With the proper data-binding, it's also great to handle a lot of animations, interactive elements, and graphics. Learn your front-end, install Vue CLI, and you're good to go with clickable prototypes.

Why would I use Vue? ›

The Vue. js framework allows software developers to create a template with the help of JSX, JavaScript and HTML. Thanks to its lightweight characteristics and component-based nature, the Vue. js framework can be implemented in almost any kind of new project.

What is Vue best used for? ›

What It's Used For: VueJS is primarily used to build web interfaces and one-page applications. In saying that, it can also be applied to both desktop and mobile app development thanks to the HTML extensions and JS base working in tandem with an Electron framework – making it a heavily favoured frontend tool.

Why use Vue instead of React? ›

What is the difference between ReactJS and VueJS? VueJS is two-way binding; whereas ReactJS is one-way binding and that's why VueJs uses more computer resources than ReactJS. Moreover, looking at the learning curve, Vue is easier than React and applications can get developed in a shorter time duration than ReactJS.

Is Vue used for frontend or backend? ›

Vue. js is an open-source JavaScript framework used for building front-end user interfaces.

What is the difference between React and Vue? ›

A simple difference between these three is that React is a UI library, and Vue is a progressive framework. However, Angular is a full-fledged front-end framework. As per StackOverflow Survey 2022, React is the favourite framework of 40.14% of developers, Angular with 22.96%, and Vue with 18.97% of developers.

What can you build with Vue? ›

Vue, or Vue. js, is a popular JavaScript framework used for front-end development. Developers most commonly use Vue for building user interfaces and one-page applications. The core library of Vue focuses on the view layer, or the UI of an application/website.

Which is faster Vue or React? ›

Vue. js offers higher performance speed, and many programmers say it is easier to learn than React. js. Its multiple customization features are also a factor that draws developers to Vue.

Does anyone use Vue? ›

Nintendo, UpWork, and Netflix are only a few of the companies using Vue. js. Because of the advantages of Vue. js, many companies and businesses use the framework to enhance their software development process.

Is JavaScript necessary for Vue? ›

Vue is a frontend framework that builds on these foundational web technologies, so it's important to have basic JavaScript knowledge and even develop a good understanding of CSS and JavaScript.

Where is Vue used? ›

Vue can be used as a standalone script file - no build step required! If you have a backend framework already rendering most of the HTML, or your frontend logic isn't complex enough to justify a build step, this is the easiest way to integrate Vue into your stack.

Which backend is best for Vue? ›

Here are the top 10 backends for Vue JS:
  • Laravel. ...
  • Firebase. ...
  • WordPress. ...
  • Heroku. ...
  • Serverless. ...
  • Django. ...
  • DigitalOcean App Platform. DigitalOcean cloud computing platform could also be a good choice to develop Vue JS backends. ...
  • Rails. If you are looking for a Ruby-based server-side framework for Vue JS, you should consider using Rails.

Can Vue be used for apps? ›

Vue (Vue. js) is a great programming framework for build single-page applications and front end web app interfaces. On its own, however, it's not a framework for building native mobile apps. There are some workarounds that let you use Vue for Android and iOS apps.


1. The best way to learn Vue.js in 2023 - CRASH COURSE
(Vue Mastery)
2. Build a Complete Weather App Using Vue.js | A Beginner's Guide
3. The Ultimate Vue 3 Tutorial (100% Composition API)
(Laith Academy)
4. Vue js Tutorial Zero to Hero || Brief Overview about Vue.js || Learn VueJS 2023 || JS Framework
(Fusion Programming)
5. A Beginner's Guide to Vue.js | What is Vue.js? | Vue.js Explained in 3 Minutes For BEGINNERS #vuejs
6. Vue JS complete tutorial | Full course for beginners | version 3
(Code Step By Step)


Top Articles
Latest Posts
Article information

Author: Domingo Moore

Last Updated: 10/06/2023

Views: 5343

Rating: 4.2 / 5 (73 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.