Higher Order Components Flashcards

1
Q

What are higher level components?

A

Components that allow us to lessen our code duplication

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

Explain the synergy between regular react component and higher order component

A

Enhance component has some additional amount of functionality or data tied to it

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

What is an example of a higher order component we have been using in redux?

A

The connect function. It is a higher order component. Connect allowed the component to access state or ‘connect’ to the redux store

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

What are the steps to building out a higher order component?

A

1) Write the logic you want to reuse into a component
2) Create a HOC file and add the HOC scaffold

scaffold boilerplate code in HOC

3) Move the reusable logic into the HOC
4) Pass props/config/behavior through to child component

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

What are the four chunks of code are the pieces of code restriction around a user’s ability

A

1) ComponentDidMount()
2) componentDidUpdate()
3) shouldNavigateAway()
4) mapStateToProps

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