In React, what is a Higher-Order Component (HOC) and what are its main caveats?

React Developer Hard

React Developer — Hard

In React, what is a Higher-Order Component (HOC) and what are its main caveats?

Key points

  • HOCs enhance components by wrapping them
  • Prop collision can occur when multiple HOCs modify the same prop
  • DisplayName can be lost when using HOCs
  • Ref forwarding issues can arise when using HOCs

Ready to go further?

Related questions