React js – What is the difference betwen HOC and decorator

For all practical reasons, decorators and HOC (Higher-Order-Component aka Wrapper) do the same thing.

One major difference is that, once you add a decorator, the property/class can only be used in it’s decorated form. HOC pattern leaves higher order as well as the lower order components available for use.

For further reading on decorators -> https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841
Decorators isn’t a widely implemented JS feature. It is still in its proposal stage. Babel 7 by default allows decorators as a default plugin in their stage 0 configuration.
https://babeljs.io/docs/plugins/transform-decorators/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)