React App Best Practices Flashcards

1
Q

What is the purpose of container components?

A

Manage the logic:

- Generate side effects at different life cycles

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

What is the purpose of presentation components?

A

Display the data

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

What is the purpose of render props?

A

To have components that share the same logic but have different presentation (huge win)

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

When should you consider using render prop?

A

When you are coding similar components to ones you have already made. Don’t try to use render before noticing code repetition, otherwise you might not get the abstraction right and mess up your code more than if you had two very similar components.

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

What are generator functions?

A

Generators are functions which can be exited and later re-entered. Their context (variable bindings) will be saved across re-entrances.

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

How to declare a generator function?

A

function* generatorName() { … }

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

What is Redux-Saga

A

Redux-Saga is a library that aims to make handling side effects in React/Redux applications easier & better.

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

Being a Redux middleware, what can Redux-Saga do?

A

Handle all the normal Redux actions and dispatch actions.

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

What is a Redux-Saga similare to?

A

It’s like a seperate thread in your application that’s solely responsible for side effects.

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

How does Redux-Saga middleware work?

A

By utilizing generator functions and handling the calling of next() and using yields whenever it needs to.

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

By convention, what are the two categories of Sagas?

A

Watchers & Workers.

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

What is the role of watcher sagas?

A

Watch for dispatched actions and fork a worker on every action.

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

What is the role of worker sagas?

A

Will handle the action and terminate

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

What are effect creators?

A

Functions which return JavaScript objects (called effects) composed of properties that tells Redux-Saga middleware how to handle these effects.

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

What does the call() effect creator does?

A

It calls the function passed a parameter (if it is an aync function, it will wait for it to end) and returns the result.

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

What does the put() effect creator does?

A

It dispatches the action passed as a parameter.