Benefit of higher-order components

Higher-order components are nothing but extended versions of your original component:

PassData({ foo: 'bar' })(MyComponent) 

The main benefit of using them is that we can use it in multiple situations, for example, authentication or login validation:

requireAuth({ role: 'admin' })(MyComponent) 

The other benefit is that with higher-order components, you can fetch data separately and set your logic to have your views in a simple way.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset