What Exactly is "Inversion Control"?
I was doing some research to try and understand the similarities and differences between React, Angular, and Vue and stumbled upon the contrast that React is a library whereas Angular and Vue are both frameworks, and that the key difference between a library and a framework is that a framework uses something called "inversion control". I can't seem to grasp this concept. My question is: what exactly is "inversion control"?
Ari Misha19,261 Points
Hello there! Inversion of Control (IoC) is much broader, which basically means Control (forget about the Inversion part). Dependency Injection(DI) is a subset of IoC. Lemme present you an example:
Suppose you bought a new expensive 4K LED TV, right? So while unboxing your new TV, you mishandle the TV and the screen breaks. Now, you're thinking of two options: let's buy a new TV of almost same specs 'coz I'm hella rich and I like spending money, and the second option is: I'm a cheapass so I want the same TV with the same 4k screen., right?
The first part represents the concept of the IoC and the latter represents the*DI. In software programming words, **IoC* is like giving control to the container to get an instance of the object, means instead of you are creating an object using the new operator, let the container do that for you.
I hope it helps!