0 votes
in ReactJS by

What is a higher order component?

1 Answer

0 votes
by

A higher-order component (HOC) is an advanced technique in React for reusing component logic. HOCs are not part of the React API. They are a pattern that emerges from React’s compositional nature.

HOC’s allow you to reuse code, logic and bootstrap abstraction. HOCs are common in third-party React libraries. The most common is probably Redux’s connect function. Beyond simply sharing utility libraries and simple composition, HOCs are the best way to share behavior between React Components. If you find yourself writing a lot of code in different places that does the same thing, you may be able to refactor that code into a reusable HOC.

Related questions

0 votes
asked Nov 26, 2019 in ReactJS by AdilsonLima
0 votes
asked Oct 9, 2019 in ReactJS by Indian
...