Vue Flashcards

1
Q

What is Vue?

A

Vue.js is a progressive framework for JavaScript used to build web interfaces and one-page applications.

Desktop and mobile app development with Electron framework

Simply put, view is a UI of an application/website, and the core library of Vue.js focuses the view layer by default.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Pros

A

Tiny size

Virtual DOM rendering and performance

Reactive two-way data binding

Single-file components and readability

Integration capabilities and flexibility

Solid tooling ecosystem

Easy to learn

Very good documentation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Virtual DOM rendering and performance

A

When a user interacts with the page, the objects change their state, so that a browser has to update the information and render it on the screen. But, updating the whole DOM is cumbersome. For the sake of speed, Vue.js utilizes virtual DOM: Think of this as a copy of an original DOM that figures out what elements to update, without rerendering the whole DOM. This approach makes page rendering pretty quick and improves application performance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Reactive two-way data binding

A

Two-way data binding is a connection between model data updates and view (UI).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Single-file components and readability

A

Every piece of the application/web page in Vue is a component. Components represent encapsulated elements of your interface. In Vue.js, components can be written in HTML, CSS, and JavaScript without dividing them into separate files.

Splitting the application code is actually an architectural approach called Component Based Architecture (CBA), and it’s also utilized in Angular and React. Such an architectural approach has lots of benefits:

Component reusability. Encapsulated components are basically chunks of code that can be reused as templates for similar system elements.

Code readability. As all the components are stored in separate files (and each component is just a single file), the code is easier to read and understand, which makes it easier to maintain and fix.

Good for unit-testing. Unit-testing is a QA activity aimed at checking how the smallest parts of the app work on their own. Having components greatly simplifies this task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Integration capabilities and flexibility

A

An important aspect of any emerging technology is the ability to integrate with existing applications. With Vue.js it’s as easy as pie, because it relies only on JavaScript and doesn’t require any other tools to work.
Between its components and lightweight nature, Vue can be used in nearly any project
Switching from React or Angular won’t be a big problem, as Vue’s internal organization is basically a mix of the two

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Solid tooling ecosystem

A

Vue CLI 3 will support Babel and TypeScript out of the box, provide unit testing, end-to-end testing tools, and a plugin installation system. And if that isn’t enough, Vue also has its own browser debugging tools, server renderer, and state manager.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Cons

A

Limited Resources

Lack of support for large-scale projects

Reactivity complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Server-Side Rendering (SSR)?

A

Vue.js is a framework for building client-side applications. By default, Vue components produce and manipulate DOM in the browser as output.

However, it is also possible to render the same components into HTML strings on the server, send them directly to the browser, and finally “hydrate” the static markup into a fully interactive app on the client.

A server-rendered Vue.js app can also be considered “isomorphic” or “universal”, in the sense that the majority of your app’s code runs on both the server and the client.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

SSR Pros

A

Better SEO, as the search engine crawlers will directly see the fully rendered page.

Faster time-to-content, especially on slow internet or slow devices. Server-rendered markup doesn’t need to wait until all JavaScript has been downloaded and executed to be displayed, so your user will see a fully-rendered page sooner.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

SSR Cons

A

Development constraints. Browser-specific code can only be used inside certain lifecycle hooks; some external libraries may need special treatment to be able to run in a server-rendered app.

More involved build setup and deployment requirements. Unlike a fully static SPA that can be deployed on any static file server, a server-rendered app requires an environment where a Node.js server can run.

More server-side load. Rendering a full app in Node.js is obviously going to be more CPU-intensive than just serving static files, so if you expect high traffic, be prepared for corresponding server load and wisely employ caching strategies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Component Lifecycle Hooks

A

beforeCreate()/created() - most often used method

beforeMount()/mounted() - html of the component is mounted onto the DOM

beforeUpdate()/updated() - triggered when a reactive property such as data or computedProperties chagnes

beforeUnmount()/unmounted() - before the compo is destroyed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

beforeCreate()/created() - most often used method

A

best place to make API calls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

beforeMount()/mounted() - html of the component is mounted onto the DOM

A

dom is ready for access and manipulation
used if the dom of the component needs to me modified before or after being rendered initially
use case - focusing input element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly