Redux Flashcards

1
Q

Architecture where shared information is found in a single object

A

Flux Architecture

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

What are the 2 key/ value pairs in an Action Object?

A

type and payload

const action = {
type: ‘todos/ addTodo’,
payload: ‘Take Selfies’
}

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

The single source of truth in flux architecture

A

Store

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

What 2 parameters are required in a reducer function?

A

store and action

const reducer = (store = initialState, action) => {
switch(action.type) {
case ‘addTodo’: {
return […store, action.payload]
}
}
}

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

Inside of the reducer function, the switch statement should always default to what?

A

Returning the store

default: {
return store
}

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

Rules of Reducers

  1. Only calculate a new state value based on _____ and _____ arguments
  2. Cannot directly _____ state. Only make changes to _____ values
  3. No _____ logic or other _____
A
  1. Only calculate a new state value based on state (store) and action arguments
  2. Cannot directly modify state. Only make changes to copied values
  3. No asynchronous logic or other side effects
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What 2 aspects define a pure function?

A
  1. Same input, same output
  2. No side effects (immutable)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The store contains what 2 items?

A

Reducer and state

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

➡️ Store ➡️ _____ ➡️ _____ 🔁

A

UI and dispatch

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

The dispatch is an event handler containing what?

A

An action object

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