New to the concept of HOC? Or having trouble understanding what HOC is and when to use it? Well, don’t worry! We will explore the concept of HOC with a real-life analogy and also with a coding example later in this post.

Have you ever seen a popcorn popper? You put in a corn kernel; a lot happens to it behind the scenes; and what comes out is a POPCORN!

An inside view of a popcorn popper! 😉

A Higher Order Component (HOC) is nothing but a POPCORN POPPER! A corn kernel goes in and a POPCORN comes out!


JavaScript, as we know, is a dynamic programming language. What does that mean? Well, in a nutshell, it means that we can add, remove, or modify properties and methods of JS objects at run-time!

With that being a pro to JavaScript’s dynamic nature, there is a con to it too. JS objects are implemented as what is called a HASH TABLE in memory. Hash tables make it much slower to retrieve a property on an object as compared to the contiguous buffer method used in non-dynamic programming languages.

SO WHAT DO WE DO!? Well, the V8 JavaScript engine has got…

Tooba Ali

Web Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store