December 2019
Intermediate to advanced
474 pages
10h 3m
English
As we mentioned previously, HOCs focus on reusing components. Therefore, it can best be described as follows:
To explain what this means in practice, let's create an example. Our project has a Board component, which fetches and renders all the lanes. There is logic in this component in the form of a constructor, a componentDidMount, and information about how each Lane component is being rendered. How would we handle a situation where we just want to show a board without lanes, but only tickets? Do we just send different props to the Board component? Sure, that's possible, but, in React, that's what HOCs are used for.
A Board component without lanes wouldn't ...