Vuex Flashcards

1
Q

What is Vuex?

A

Vuex is a library to manage global state.

or

Vuex helps manage Data that affects multiple components over the entire app

For example.

  • Auth
  • Shopping cart items
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is Vuex worth using?

A

Vuex affects your codebase:

L: less error-prone
A: avoid fat components
R: reduces unpredictably

by

C: clearly defined data flow
O: Outsourced state management
P: Predictable state management / flow

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

What do mutations do?

A

changes values in a state.

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

What do getters do?

A

Returns values from the a state

it is where you ‘get a value’. from the state.

you can manipulate it here , and it won’t change I the state. i.e multiplier the value by 3

it will then send the data onward.

method

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

what do actions do?

A

components should trigger acoutions

actions should trigger mutations

note! components should not trigger mutations

Used for asynrous code.

method

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

What are the core components that are used in Vuex

What is the core file structure.

A

You have

G: Getters
A: Actions
M: Mutations
S: State

Folder structure.

Store
index
Actions
mutations

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

How do you interact witt the store

A

$store.state.data

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

what is a payload

A

it can be aything , number / object , it just represent data that has been passed on a commit.

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

what is a payload

A

it can be aything , number / object , it just represent data that has been passed on a commit.

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

what does _ do in an argument ( _, something)

A

it’s an indication that that you recognise that it has a argument that you do not want to use it

for example not needing the store on a getter

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