Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Higher order component Vs Parent component

I have been writing React code for long time, but when it come to choose Higher order Component(HOC) vs Parent component, i am not able to decide which one to choose, both seems to do same thing.

  1. Render Highjacking
  2. Code reuse, logic and bootstrap abstraction
  3. Props manipulation
  4. State abstraction and manipulation
like image 504
Khalid Azam Avatar asked Nov 08 '22 22:11

Khalid Azam


1 Answers

This article has a great section comparing the 2 in the section Appendix B: Difference with Parent Components I'm still digging in to find out the core differences and when to use each as I have just been looking into this recently.

https://medium.com/@franleplant/react-higher-order-components-in-depth-cf9032ee6c3e

like image 90
Alex Bezek Avatar answered Nov 14 '22 23:11

Alex Bezek