July 8th, 2024

Build your own React (2019)

Rodrigo Pombo's guide demonstrates building a simplified React version from scratch, focusing on React 16.8 with hooks. It covers creating core functions, Concurrent Mode, Fibers, and reconciliation. The tutorial emphasizes understanding React's internals by gradually implementing key features.

Read original articleLink Icon
Build your own React (2019)

In a detailed guide, Rodrigo Pombo explains how to build a simplified version of React from scratch, focusing on React 16.8 with hooks. The process involves creating functions like createElement and render, implementing Concurrent Mode, Fibers, and handling reconciliation. The tutorial provides step-by-step instructions on recreating React's core functionalities using vanilla JavaScript. By breaking down the rendering process into smaller units of work and utilizing requestIdleCallback, the tutorial aims to prevent blocking the main thread during rendering. Additionally, it introduces the concept of Fibers as a data structure to organize units of work efficiently. The tutorial emphasizes understanding the inner workings of React by implementing key features gradually. While the tutorial references React's internal mechanisms, it encourages readers to build their own React-like library called Didact.

Link Icon 3 comments
By @sxp - 3 months
For those wondering how the site was made, the author has a bunch of videos explaining his frameworks for coding tutorials: https://www.youtube.com/c/RodrigoPombo

His Scrollycoding framework uses a DSL similar to markdown+xml for the script and generates the webpage from it.

By @wackget - 3 months
It's funny, I've been a web developer for many, many years and I've yet to see any compelling argument for why React (or similar libraries) should even exist.

Every single time I look into them I just can't find a reason why I'd ever want to use them over regular HTML and JavaScript. This is especially true in recent years when so many convenience functions have been added to the languages which you'd only previously find in the likes of jQuery etc.

I've looked at framework comparison sites like ToDoMVC.com and the React code just looks so disgustingly over-engineered.

I just don't get it at all.

By @drivingmenuts - 3 months
Interesting - the one thing that makes me leery of React is that design is not separated from code. I'm used to HTML and CSS being in the province of the designer and I absolutely hate that there is no separation of concerns. The one thing I would remove from React is the ability to specify styling other than class and/or id for all but a few elements.

Now, it looks like I can do just that, maybe?