code q&a
Resources About
Question:

What is Vue?

Vue is a free, open source framework for building the parts of a website you see and click on. It’s one of the most popular tools for front-end development.

Evan You created Vue and released it in 2014. He had used a framework called AngularJS while working at Google and wanted something lighter that kept only the parts he liked. People and companies that use Vue pay for its development through sponsorships, while its biggest rival React is backed by Meta.

You build a page in Vue out of small pieces like a button or a menu. Each piece is called a component and you can use it as many times as you want. Vue updates the page for you when your data changes, like bumping the cart icon from 2 to 3 when someone adds an item. You don’t have to write code that finds that number on the page and updates it. Here’s a small component with a button that counts items in a cart:

<template>
  <button @click="count++">Cart ({{ count }})</button>
</template>

<script setup>
import { ref } from 'vue'

const count = ref(0)
</script>

<style>
button {
  color: green;
}
</style>

Clicking the button adds one to count and Vue updates the number on the button by itself.

Vue is known for being easy to pick up, partly because each component keeps its HTML, CSS and JavaScript together in one file like the example above. You can also add Vue to an existing page a little at a time instead of rebuilding the whole site.

Nuxt is a framework built on top of Vue that handles the extra pieces a full website needs, like giving each page its own URL and rendering pages on the server so they load faster. It does the same job for Vue that Next.js does for React.

You might also like