Let’s review why ReactJS became rather popular!
Its philosophy can be summed as:
- write components
- concentrate on one task at hand
- your button is a button is a button
- tight isolation of the internals of a component
- say goodbye to most variable hoisting bugs in your code!
- if you can’t see your whole component without scrolling in your editor, refactor your code!
The real benefits of component thinking?
Think of that delicious piece of cake. Doesn’t it look clean, very enticing? There are layers; and the cake has a definite shape. However, the process of making one piece of cake is nothing but clean.
[Sorry guys – I have no idea why I brought that cake here. I’m trying a sugarless diet mostly]
In React, each component has a shield against global scope.
Each component also protects the scope at the same time. It’s a two way street, except… well, two-way was bad analogue. Since in React, the whole idea started with ‘props’: passing each component the necessary information, strictly one way. The component doesn’t see the global scope, and it shouldn’t.
Your React components are the hot-blooded trotters with eye patches properly aligned to make your web app a winner!