Vue3: Modern Frontend App Development

Rate this content
Bookmark
The video discusses the transition from Vue 2 to Vue 3, highlighting the benefits of using the Composition API for better code organization and reuse. It details the Vue initialization API changes, emphasizing the use of the 'create app' syntax for separating functionality. The video explains how to create reactive variables using 'ref' and 'reactive', and the importance of computed properties for derived values. The use of lifecycle hooks inside the setup function is covered, providing examples of loading data and making API calls. The video also explores the use of VueUse for managing CSS variables and interacting with local storage. Additionally, the Provide/Inject feature is discussed for passing data between components. The workshop includes a demo of creating a simple counter component, connecting it to a store and router, and making it asynchronous.

From Author:

The Vue3 has been released in mid-2020. Besides many improvements and optimizations, the main feature of Vue3 brings is the Composition API – a new way to write and reuse reactive code. Let's learn more about how to use Composition API efficiently.

Besides core Vue3 features we'll explain examples of how to use popular libraries with Vue3.

Table of contents:
- Introduction to Vue3
- Composition API
- Core libraries
- Vue3 ecosystem

Prerequisites:
IDE of choice (Inellij or VSC) installed
Nodejs + NPM

This workshop has been presented at Vue.js London Live 2021, check out the latest edition of this Tech Conference.

FAQ

Vue 3 is the third version of the Vue.js framework, known for its progressive JavaScript capabilities. It introduces features like the Composition API, improved TypeScript support, and better performance through techniques like tree-shaking. Vue 3 also enhances modularity and provides tools like the migration build to help transition from Vue 2, ensuring backward compatibility and facilitating the adoption of new features gradually.

The Composition API in Vue 3 allows for better code organization and reuse by encapsulating logic into composable functions. This API makes the code more maintainable and testable by decoupling it from the components and promoting reuse of logic across different parts of your application. It supports TypeScript better, enabling more robust type-checking and enhancing developer productivity.

The VueUse library provides a collection of essential Composition API functions (referred to as hooks) that handle many common functionalities in Vue 3 projects, such as managing CSS variables, interacting with local storage, or detecting user actions. Using VueUse simplifies development, reduces boilerplate, and improves code readability and maintainability.

In Vue 3, the Provide/Inject feature allows for dependency injection, enabling a parent component to provide data or dependencies, which can then be injected into any descendant component in the component tree. This feature simplifies the component structure, avoids prop drilling, and enhances component reusability and maintainability.

For migrating from Vue 2 to Vue 3, developers can utilize the Vue Demi library for supporting both versions simultaneously in libraries or plugins, and the migration build which offers a compatibility build to gradually adopt Vue 3 features while ensuring the application remains functional. These tools help manage the transition smoothly by allowing incremental updates and testing.

Mikhail Kuznetcov
Mikhail Kuznetcov
169 min
26 Oct, 2021

Comments

Sign in or register to post your comment.

Video Transcription

1. Introduction and Workshop Overview

Short description:

I'm Mikhail and I will be running today's workshop about Vue 3 features. We'll focus on the composition API and I'll showcase its benefits in a demo. I've been using Vue since version 1 and became a big fan. Follow me on Twitter for more Vue and front-end development content. Let's do a quick round of introductions to understand the audience's technical stack.

I'm Mikhail and I will be running today's workshop about view 3 features. I'm really happy to see a lot of messages in the chat. Great, great, guys. I see that you can hear me definitely, and hope you can see the picture clearly. So if along the way there are any disturbances with the video or sound quality, please let me know. That shouldn't happen normally, but we'll see. Cool.

So let's... I think it's enough time for people to join already, let's move on. So, what are we going to be talking about today? Mostly focusing on Vue 3, the third version. And I'll start with some basics introduction then I'll do a more deep dive into the Vue 3 features, mostly composition API, and then we'll go into demo mode, when I will be showcasing most of the items that composition api brings. Let me quickly introduce myself, Mikhail. I'm developing web for over a decade now. I currently work as a team lead at ING Bank in Amsterdam. I started first using Vue somewhere around 2016, when it was still version 1, and actually when Geiss released version 2, I was really fascinated how easy and composable it is to build complex web UIs. And also the ecosystem documentation, everything was really nice, so I became a really big fan of this framework. Since then, I've been using it in a lot of commercial and side projects as well.

You can follow me on Twitter. This is a hard to pronounce set of characters. So, please, if you can't write it down, I will type it in the chat. So, I'll be happy to answer your questions in the chat, here during the session, but also follow me on Twitter. I'll try to post some stuff related to Vue and front-end development once in a while.

Yeah. Let's also do a quick round of introduction. That will also help me to understand better the audience level and also serve like an introduction so we know the composition of today's participants. So, can you please write down in short sentence your technical stack, what other frameworks or libraries, languages you use daily. If you're still studying, it's also fine. Just it can be back and front and I don't know, web design, data science, whatever, just in one line, something like PHP, three years, that should work. So please share your current stack or the stack that you are interested in. If you're using vue, of course, it would be nice to know which version are you using mostly. So please I'll give about a minute for this and then we'll move on.

2. Introduction to Vue and Workshop Overview

Short description:

Yeah, I hope you liked it. I'm really happy to present a workshop in this community. Vue is a community-driven, super successful open-source project with almost 200,000 stars on Github. It has a brilliant ecosystem of tools and is used a lot across the industry. Vue is steadily gaining popularity and is a great choice for any size of project. Give it a shot and you may also like it. A typical Vue component has logic and templates, where you can output data, bind events, and reuse parts or other components. The main part is in the JavaScript side, where you define properties, state variables, and use methods to mutate data. This is called the options API.

Yeah, I saw some first message. Thanks Robert. Switching from Angular. Oh, that's a very well known story for me. Yeah, I had the same challenge some years ago. Yeah, I think you'll find a lot of similar concepts and yeah, definitely the way you can compose components and reuse logic, you should definitely like it. So I hope you like the journey, Robert. Ricardo vue 2.0, slash three. Great, great. Andrei, Laravel, PHP. Cool. Clement, thanks, thanks. Adam, Lucas. Well, a lot of stuff guys were using here. Oh, nice, nice. I see quite often views mentioned, which is good because we're on Vue conference. And yeah, I also see that it's a, version 2.0 is still oftenly used, which is completely understandable. It's a stable version, which was with us for almost four years. And yeah, like even being an expert on the third version, I still sometimes just would strap a new project and quickly do it on the version two because I just the kind of muscle memory and you don't need to think about any complex concepts, but yeah, we are mostly will be focusing on version three, which I think it's a, will be beneficial for most of you who are still using version two. Cool, cool, I see Carloi, Barthek. Yeah, thanks guys. Thanks for all the details. Really nice. C Sharp from position API, Dave, boss. Thanks, very nice. Cool, and also, so we're doing now the workshop which is part of the conference. And of course, the days when the conference main activities were held already passed, but yeah, I hope you liked it. I heard it was quite a lot of interesting announcements and talks by the core team members, so I'm really happy to present a workshop in this community. So let's move on, thanks for all the input. Actually, for those who mentioned React, I have a couple of slides comparing React hooks with Vue Composition API, so that might be a bit of help also to those. Oh, I see also Sergio mentioned the Vue School masterclass. Cool, yeah, I did some content for Vue School, specifically around version 3, yeah. Vue School is a nice learning source. Great to hear you're using it.

Okay, so a brief intro about Vue, because I think we will mostly know what it is, but just to recap. So, it's called Progressive JavaScript Framework. It started somewhere around 2015 by a guy named Ivan Yeo, who was formerly developing AngularJS at Google. And nowadays, it's a community-driven, super successful open-source project, which has, as we'll see, almost 200,000 stars on Github. It has certain design choices, such as template logic and data composition for the component logic, watchers, computed functions, which people who use Angular will find familiar. It relies on the common concept, which is called virtual DOM. The one that is also used widely by React, and it has a brilliant ecosystem of tools. We will look at some of them today, such as Vue CLI, to bootstrap a project, router, to basically switch pages and different parts of your viewport on the client side, state manager, which is a separate package called Vuex. We will also look into this today. It also has server-side rendering solutions like Nuxt. So if you've visited conference talks, you probably learn about them a lot. So we'll speak about some of them also. And it's used a lot across the industry. Not only by basically small teams, but also by enterprise level companies who need code reuse and functionality at scale. So, yeah, I think it's a great choice for any size of project. Yeah, just a quick recap about the current state of affairs. Yeah, I had this graph plot imported from npm compare. And here you can see several metrics such as amount of package downloads per day, I guess, or per week, for three major frameworks. So you can see Vue is steadily having a second place, which is maybe three times, four times less than React. However, in the star count, that's significantly more than for React. I think that's a great achievement for a project which is fully community, and Becca's founded. It doesn't have any big corporation behind it. So I think it's really exciting to use such a tool. I myself wrote several plugins. They are not that successful, but it was a nice experience, actually. I think that the way the documentation is aligned since version two and for version three, as well, it makes it really accessible and easy for everyone to build custom stuff on top of Vue. So if you haven't tried creating some reusable code, open source code for Vue, give it a shot. Maybe you will also like it.

Okay. Let me check. Okay. So yeah, a brief look on the field. What is the typical Vue component looks like? So it has, as I said, logic and the templates, you can output data from your model and you can bind to events and do certain, yeah, reuse some parts of the template, or reuse other components in the template. And the main part is in the JavaScript side where you can define your properties, your state variables using a data function or data object. And you can use methods to mutate these data, and you can have a bunch of other stuff like watch, computed, and other types of variables. So all this part basically is called options API.

QnA

Watch more workshops on topic

React, TypeScript, and TDD
React Advanced Conference 2021React Advanced Conference 2021
174 min
React, TypeScript, and TDD
Top Content
Featured WorkshopFree
Paul Everitt
Paul Everitt
ReactJS is wildly popular and thus wildly supported. TypeScript is increasingly popular, and thus increasingly supported.

The two together? Not as much. Given that they both change quickly, it's hard to find accurate learning materials.

React+TypeScript, with JetBrains IDEs? That three-part combination is the topic of this series. We'll show a little about a lot. Meaning, the key steps to getting productive, in the IDE, for React projects using TypeScript. Along the way we'll show test-driven development and emphasize tips-and-tricks in the IDE.
Web3 Workshop - Building Your First Dapp
React Advanced Conference 2021React Advanced Conference 2021
145 min
Web3 Workshop - Building Your First Dapp
Top Content
Featured WorkshopFree
Nader Dabit
Nader Dabit
In this workshop, you'll learn how to build your first full stack dapp on the Ethereum blockchain, reading and writing data to the network, and connecting a front end application to the contract you've deployed. By the end of the workshop, you'll understand how to set up a full stack development environment, run a local node, and interact with any smart contract using React, HardHat, and Ethers.js.
Remix Fundamentals
React Summit 2022React Summit 2022
136 min
Remix Fundamentals
Top Content
Featured WorkshopFree
Kent C. Dodds
Kent C. Dodds
Building modern web applications is riddled with complexity And that's only if you bother to deal with the problems
Tired of wiring up onSubmit to backend APIs and making sure your client-side cache stays up-to-date? Wouldn't it be cool to be able to use the global nature of CSS to your benefit, rather than find tools or conventions to avoid or work around it? And how would you like nested layouts with intelligent and performance optimized data management that just works™?
Remix solves some of these problems, and completely eliminates the rest. You don't even have to think about server cache management or global CSS namespace clashes. It's not that Remix has APIs to avoid these problems, they simply don't exist when you're using Remix. Oh, and you don't need that huge complex graphql client when you're using Remix. They've got you covered. Ready to build faster apps faster?
At the end of this workshop, you'll know how to:- Create Remix Routes- Style Remix applications- Load data in Remix loaders- Mutate data with forms and actions
Developing Dynamic Blogs with SvelteKit & Storyblok: A Hands-on Workshop
JSNation 2023JSNation 2023
174 min
Developing Dynamic Blogs with SvelteKit & Storyblok: A Hands-on Workshop
Top Content
Featured WorkshopFree
Alba Silvente Fuentes
Roberto Butti
2 authors
This SvelteKit workshop explores the integration of 3rd party services, such as Storyblok, in a SvelteKit project. Participants will learn how to create a SvelteKit project, leverage Svelte components, and connect to external APIs. The workshop covers important concepts including SSR, CSR, static site generation, and deploying the application using adapters. By the end of the workshop, attendees will have a solid understanding of building SvelteKit applications with API integrations and be prepared for deployment.
Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Featured Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.
Back to the Roots With Remix
React Summit 2023React Summit 2023
106 min
Back to the Roots With Remix
Featured Workshop
Alex Korzhikov
Pavlik Kiselev
2 authors
The modern web would be different without rich client-side applications supported by powerful frameworks: React, Angular, Vue, Lit, and many others. These frameworks rely on client-side JavaScript, which is their core. However, there are other approaches to rendering. One of them (quite old, by the way) is server-side rendering entirely without JavaScript. Let's find out if this is a good idea and how Remix can help us with it?
Prerequisites- Good understanding of JavaScript or TypeScript- It would help to have experience with React, Redux, Node.js and writing FrontEnd and BackEnd applications- Preinstall Node.js, npm- We prefer to use VSCode, but also cloud IDEs such as codesandbox (other IDEs are also ok)

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Don't Solve Problems, Eliminate Them
React Advanced Conference 2021React Advanced Conference 2021
39 min
Don't Solve Problems, Eliminate Them
Top Content
Kent C. Dodds discusses the concept of problem elimination rather than just problem-solving. He introduces the idea of a problem tree and the importance of avoiding creating solutions prematurely. Kent uses examples like Tesla's electric engine and Remix framework to illustrate the benefits of problem elimination. He emphasizes the value of trade-offs and taking the easier path, as well as the need to constantly re-evaluate and change approaches to eliminate problems.
Everything Beyond State Management in Stores with Pinia
Vue.js London Live 2021Vue.js London Live 2021
34 min
Everything Beyond State Management in Stores with Pinia
Top Content
State management is not limited to complex applications and transitioning to a store offers significant benefits. Pinia is a centralized state management solution compatible with Vue 2 and Vue 3, providing advanced devtools support and extensibility with plugins. The core API of Pinia is similar to Vuex, but with a less verbose version of stores and powerful plugins. Pinia allows for easy state inspection, error handling, and testing. It is recommended to create one file per store for better organization and Pinia offers a more efficient performance compared to V-rex.
Welcome to Nuxt 3
Vue.js London Live 2021Vue.js London Live 2021
29 min
Welcome to Nuxt 3
Top Content
Nux3 has made significant improvements in performance, output optimization, and serverless support. Nuxt Bridge brings the Nitro engine for enhanced performance and easier transition between Nuxt 2 and Nuxt Read. Nuxt 3 supports Webpack 5, Bytes, and Vue 3. NextLab has developed brand new websites using Docus technology. Nuxt.js is recommended for building apps faster and simpler, and Nuxt 2 should be used before migrating to Nuxt 3 for stability. DOCUS is a new project that combines Nuxt with additional features like content modules and an admin panel.
One Year Into Vue 3
Vue.js London Live 2021Vue.js London Live 2021
20 min
One Year Into Vue 3
Top Content
Vue 3 has seen significant adoption and improvements in performance, bundle size, architecture, and TypeScript integration. The ecosystem around Vue 3 is catching up, with new tools and frameworks being developed. The Vue.js.org documentation is undergoing a complete overhaul. PNIA is emerging as the go-to state management solution for Vue 3. The options API and composition API are both viable options in Vue 3, with the choice depending on factors such as complexity and familiarity with TypeScript. Vue 3 continues to support CDN installation and is recommended for new projects.
Utilising Rust from Vue with WebAssembly
Vue.js London Live 2021Vue.js London Live 2021
8 min
Utilising Rust from Vue with WebAssembly
Top Content
In this Talk, the speaker demonstrates how to use Rust with WebAssembly in a Vue.js project. They explain that WebAssembly is a binary format that allows for high-performance code and less memory usage in the browser. The speaker shows how to build a Rust example using the WasmPack tool and integrate it into a Vue template. They also demonstrate how to call Rust code from a Vue component and deploy the resulting package to npm for easy sharing and consumption.
Vue: Feature Updates
Vue.js London 2023Vue.js London 2023
44 min
Vue: Feature Updates
Top Content
The Talk discusses the recent feature updates in Vue 3.3, focusing on script setup and TypeScript support. It covers improvements in defining props using imported types and complex types support. The introduction of generic components and reworked signatures for defined components provides more flexibility and better type support. Other features include automatic inference of runtime props, improved define emits and defined slots, and experimental features like reactive props destructure and define model. The Talk also mentions future plans for Vue, including stabilizing suspense and enhancing computer invalidations.