React As it is…
Off lately, the front end spectrum has grown by leaps and bounds and this has left a huge hole in the learning curve. Every 3 months, a new library gets popular and within no time, you find yourself working on it. While many of them couldn’t stand the test of time, few have made a remarkable imprint. React, in my opinion, tops the list as of today.
Now this post is not going to look into the nitty gritty of what React is, how is it better and what not( I will cover those in upcoming posts). I am writing this for a total newbie who wants to jump into Web dev and learn React. So the question I am answering here is, Why React?
Before we answer the very basic question, why React, lets dwell a little bit on something off topic yet insanely related to it.
What can we deduce from the picture of this modular home? Repetitions, right? Same type of window, used at 4 places. Assuming that the white gates are garage gates, they too are identical. A lot here is identical. The best thing about this kind of building is that the manufacturer had complete control over these identical parts of the building. He shouldn’t have to go through a rigorous process of making each identical item from scratch. Rather a molding, a blueprint or something on the same lines would have helped him finish the task in less time and with less work.
This has following advantages:
1. Work takes less time.
2. Its more accurate.
3. Not only it takes less time, it reduces the labor as well.
Back to ReactLand :
React also works on same lines and this is the main why of React. We can build some solution in form of components and can use copies of those components at different places in our code. What more, we can customize our components. Lets say, in the above example, once we get all our 4 identical windows, we can still customize them like paint them differently, cover there glasses with different kind of films etc. When we build our application in a modular way, the code we write becomes more manageable, readable and reusable.
Till now I gave the example of reusability. Lets explore other aspects. When we work on components and use them in our app, it becomes easier to manage. As there are always chances of code breaking somewhere down the road, if we make our app as one big chunk of code, we will get a really messed up code and it goes out of hands very quickly. This is the beauty of working with components, you break your car axle, you get axle repaired only, not the whole car. Likewise, you break something in your code, you go and fix that particular component only. Rest of the things keep working as they do.
Since you have broken your code in components, you have made it easier to read. The less lines to read, the clearer the code(off course, code understanding required).
Learning React will take some time and has some learning curve to it but understanding the basic idea is very important and so React as it is.
Will come up with more posts on React. Feel free to ask more if you are a newbie. Add your comments, if you are experienced.
Happy Coding/Learning.