Vue basics Flashcards

A simple set of card to understand the fundamentals of the vue framework

1
Q

What is reactivity?

A
  • Reactivity is a programming paradigm that allows us to adjust to changes in a declarative manner.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a Proxy?

A
  1. Proxy is an object that encases another object or function and allows you to intercept it.
  2. The Proxy object enables you to create a proxy for another object, which can intercept and redefine fundamental operations for that object.

A Proxy is created with two parameters:

  • target: the original object which you want to proxy
  • handler: an object that defines which operations will be intercepted and how to redefine intercepted operations.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why are proxy’s important to understand when using Vue?

A
  • They are core funcationality of Java script that Vue uses to make it reacative
  • Proxy is an object that encases another object or function and allows you to intercept it.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How many vue apps can you have per page

A

as many as you want. Imporant they will work independitly from each other They cannot share data

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

What are templates

A

They are used to insert template html in a vue app.

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

What is the purpose of $Ref in relation to Vue?

A

We use the $ref in our Vue.js code. to provide and object which provides a complete list of the references defined in the HTML code.

Example:

referencing the input “text”

ref=”input”>

  • to log the out put in vue js*
    console. log(this.$refs.input)

would log the value of “input”

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

what does $ represent.

A

A dollar sign $ will refer to Vue instance properties and methods.

  • They are prefixed to differentiate the from user-defined properties
  • Examples : this.$refs vm.$data vm.$props

reference

https://vuejs.org/v2/api/#Instance-Properties

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

Why would you use .value in javascript?

A

.values() is used to coovert on an object to return into an array containing the values as an an array.

const object1 = {
 a: 'somestring',
 b: 42,
 c: false
};
**console.log(Object.values(object1));**
// expected output: Array ["somestring", 42, false]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Virtual Dom?

A

The Virtual Dom:

The virtual DOM (VDOM) is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library This process is called reconciliation.

It is used :

To tell what state you want the UI to be in, and it makes sure the DOM matches that state.

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

What is the Vue instance Lifecycle?

A

It describes the life cycle of an app

  • what the step processes for mounting
  • before mount \ mounted before
  • update updated
  • before unmount
  • unmounted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what are Vue components?

A
  • They are used when you want to reuse HTML blocks
  • They are normally broken up into specific functionality specific to that block.
  • splitting up a large app or min apps
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is the:key attribute why is it important?

A
  • The key attribute is used on lists.
  • It indicates the unique variable ( primary key ) that the list can iterate over
  • *
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you create a component?

A

app.component(‘name-something’);

  • The name should always have a dash
  • e.g foo-barr my-name
  • This avoids clashing with bulit in elements
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you use components?

A

You insert the same way as you would use a normal div

*

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

why build ann interface with components

A
  • Components are building blocks that simplify the structure of apps.
  • They proved a communication mechanism that allows components to speak across components, this does not happen with multiple apps.

// check this and come back when you’re sure.

: study components

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

What are Directives can you name three?

A
  • Directives are special attributes provided by Vue.
  • Indicated by ‘v-‘ They apply special reactive behaviour to the rendered
  • examples
    • v-bind
    • v-on
    • v-if
    • v-for
17
Q

what is the v-on directive?

A

Attaches an event listener to the element.

List of events

*

18
Q

what does v-model do

A

two way bindig bettwen form input and app state so it will allow you to change the data in an app easily for example.

19
Q

how do you stop exisitng properties from being changed

A

Object.freeze(obj) it also stof the reactive system from tracking changes

20
Q

What is an Interpolation

A

the insertion of something of a different nature into something else. for example {{ mustache }} is insterted instead of txt the value will be replaced with mustache property on the corresponding data object

21
Q

What does v-html do

A

The contents of the span will be replaced with the value of the rawHtml property, interpreted as plain HTML - data bindings are ignored

22
Q

Describe Computed properties in vue

A

computed properties are methods that can be called by their dame through the project

  • computed properties are cached based on their reactive dependencies.
  • A computed property will only re-evaluate when some of its reactive dependencies have changed.
23
Q

what is a slug in coding terms?

A

A slug is a human-readable, unique identifier, used to identify a resource instead of a less human-readable identifier like an id . You use a slug when you want to refer to an item while preserving the ability to see, at a glance, what the item is.

24
Q

What is declarative programming?

A

Declarative programming is a non-imperative style of programming in which programs describe their desired results without explicitly listing commands or steps that must be performed. Functional and logical programming languages are characterized by a declarative programming style.

25
Q

What is a Programming paradigm?

A

Programming paradigms are a way to classify programming languages based on their features.

… Some paradigms are concerned mainly with implications for the execution model of the language, such as allowing side effects, or whether the sequence of operations is defined by the execution model.

26
Q

What is an instance method

A

All Person objects will have this method

this is due to the prototype structure of javascript

Person.prototype.setName = function(nameIn) {

this.name = nameIn;

27
Q

Canonical

A

Canonical means :

  • the simplest form of something specifically
  • : the form of a square matrix that has zero elements everywhere except along the principal diagonal.
28
Q
A
29
Q

what types do props support

A

​Props support the following eight types

  1. String
  2. Number
  3. Boolean
  4. Array
  5. Object
  6. Date
  7. Function
  8. Symbol