Higher Order Components Flashcards
What are higher level components?
Components that allow us to lessen our code duplication
Explain the synergy between regular react component and higher order component
Enhance component has some additional amount of functionality or data tied to it
What is an example of a higher order component we have been using in redux?
The connect function. It is a higher order component. Connect allowed the component to access state or ‘connect’ to the redux store
What are the steps to building out a higher order component?
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
What are the four chunks of code are the pieces of code restriction around a user’s ability
1) ComponentDidMount()
2) componentDidUpdate()
3) shouldNavigateAway()
4) mapStateToProps