Recreating React
So, I've been using React for a while now, and recently I decided to really dive deep and understand the nuts and bolts of it. There were always these questions that kept popping up in my mind, like "How does React transform all that JSX jargon into delightful DOM nodes?" and "How do hooks keep track of their state?" So, I decided to find out!
Following the advice of Raymond Gan and others, I took on the challenge of creating my own React clone. I thought it would not only be a great learning experience but also a fantastic way to showcase my abilities as a junior developer.
Going into this project, I thought I had a pretty solid grasp of React, but boy, was I wrong! I learned so much more by actually building it from scratch. For instance, I always thought state was closely tied to the component it resides in. But turns out, all the hooks from an app are kept in a single global hooks array, and each hook just keeps a reference to its index in that array. I was quite surprised to discover this!
If you're curious to see how I did it, I've written a detailed article over on Medium that you can check out. I included the software tests so you can see exactly what its capabilities are. Plus, I made a YouTube video demonstrating the whole thing in action. Feel free to take a look, and let me know your thoughts!
In-depth explanation: Medium Article
Source: GitHub Project