Why and what I love about React.js
When it comes to single-page application development, there are more options than one could probably memorize. In general, react.js is ranked near or at the top. The Facebook team accomplished something great with their development of the framework. In a sense, it was a no-brainer for a website with a massive potential amount of components being displayed to focus on… the component, and how they interact and share data. Not to mention that being “DRY” and adhering to the “single source of truth” idea has saved many a developer hours of their lifetime and many a keyboard its keys in the never-ending journey of debugging. If I tried to liken this framework to a board game, it would be a strange hybrid of dominoes and puzzle pieces. Dominoes due to the cascading, hierarchical nature of states and props. Changing state up the chain of prop hierarchy has the ability to re-render or modify every component beneath it. And puzzle pieces because many different components come together to make one coherent whole that the user experiences.
In the process of baking a pie, the worst thing the average person will do is add a little too much of something, or maybe missread and miss a step. When it comes to the way a processor would communicate, however, the instructions not only need to be step by step and accurate, but the order matters. And some things take longer than others. Just like in our pie, you wouldn’t want to take it out of the oven while the dough is still not ready just to move onto the fillings.(Don’t quote me on pie making, I’m still at the ramen stage) What a thunk essentially does is let the code execute a function on cue. In the case of the react thunk middleware, an object is also passed into the thunk with a little help of our friendly closures. So in essense, react thunk’s role in our soon to be pie is to be able to pass say that once the pie is properly cooked, can set set an action(dispatch) that can then impact our state. For example, once we take the pie out, we can dispatch an action that changes our project from being incomplete to being ready and delicious. And once the appropriate guests(components) are made aware that the pie in nice and ready, they can alter what they do and display in response(in React-ion).